Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 4478:b2b55acbacdd
Add support for url#id syntax
This allows you to do:
hg clone http://server/repo#stable
which is equivalent to:
hg clone -r stable http://server/repo
Future incoming, outgoing, and push commands will default to using
this id because it's recorded in the default path.
Other commands that accept URLs (push, pull, bundle, incoming, and
outgoing) also accept this syntax.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 01 Jun 2007 18:40:14 -0500 |
parents | 736e49292809 |
children | 591322269fed |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Fri Jun 01 18:52:18 2007 -0500 +++ b/mercurial/cmdutil.py Fri Jun 01 18:40:14 2007 -0500 @@ -11,6 +11,15 @@ revrangesep = ':' +def parseurl(url, revs): + '''parse url#branch, returning url, branch + revs''' + + if '#' not in url: + return url, (revs or None) + + url, rev = url.split('#', 1) + return url, revs + [rev] + def revpair(repo, revs): '''return pair of nodes, given list of revisions. second item can be None, meaning use working dir.'''