diff mercurial/commands.py @ 10365:d757bc0c7865

interpret repo#name url syntax as branch instead of revision Previously, the name part of an repo#name url was interpreted as a revision, similar to using the --rev option. Now it is instead looked up as a branch first, and if that succeeds all the heads of the branch will be processed instead of just its tip-most head. If the branch lookup fails, it will be assumed to be an revision as before (e.g. for tags).
author Sune Foldager <cryo@cyanite.org>
date Sun, 07 Feb 2010 14:29:07 +0100
parents de1e7099d100
children 98a0421b9e52
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Feb 07 14:01:43 2010 +0100
+++ b/mercurial/commands.py	Sun Feb 07 14:29:07 2010 +0100
@@ -538,9 +538,10 @@
                         seen[p] = 1
                         visit.append(p)
     else:
-        dest, revs, checkout = hg.parseurl(
-            ui.expandpath(dest or 'default-push', dest or 'default'), revs)
+        dest = ui.expandpath(dest or 'default-push', dest or 'default')
+        dest, branches = hg.parseurl(dest)
         other = hg.repository(cmdutil.remoteui(repo, opts), dest)
+        revs, checkout = hg.addbranchrevs(repo, other, branches, revs)
         o = repo.findoutgoing(other, force=opts.get('force'))
 
     if revs:
@@ -607,7 +608,8 @@
 
     a) the changeset, tag or branch specified with -u/--updaterev
     b) the changeset, tag or branch given with the first -r/--rev
-    c) the head of the default branch
+    c) the branch given with the url#branch source syntax
+    d) the head of the default branch
 
     Use 'hg clone -u . src dst' to checkout the source repository's
     parent changeset (applicable for local source repositories only).
@@ -1727,8 +1729,9 @@
 
     revs = []
     if source:
-        source, revs, checkout = hg.parseurl(ui.expandpath(source), [])
+        source, branches = hg.parseurl(ui.expandpath(source))
         repo = hg.repository(ui, source)
+        revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
 
     if not repo.local():
         if not rev and revs:
@@ -1919,9 +1922,10 @@
     See pull for valid source format details.
     """
     limit = cmdutil.loglimit(opts)
-    source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
+    source, branches = hg.parseurl(ui.expandpath(source))
     other = hg.repository(cmdutil.remoteui(repo, opts), source)
     ui.status(_('comparing with %s\n') % url.hidepassword(source))
+    revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
     if revs:
         revs = [other.lookup(rev) for rev in revs]
     common, incoming, rheads = repo.findcommonincoming(other, heads=revs,
@@ -2206,9 +2210,9 @@
     See pull for valid destination format details.
     """
     limit = cmdutil.loglimit(opts)
-    dest, revs, checkout = hg.parseurl(
-        ui.expandpath(dest or 'default-push', dest or 'default'),
-        opts.get('rev'))
+    dest = ui.expandpath(dest or 'default-push', dest or 'default')
+    dest, branches = hg.parseurl(dest)
+    revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
     if revs:
         revs = [repo.lookup(rev) for rev in revs]
 
@@ -2327,9 +2331,10 @@
     If SOURCE is omitted, the 'default' path will be used.
     See 'hg help urls' for more information.
     """
-    source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
+    source, branches = hg.parseurl(ui.expandpath(source))
     other = hg.repository(cmdutil.remoteui(repo, opts), source)
     ui.status(_('pulling from %s\n') % url.hidepassword(source))
+    revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
     if revs:
         try:
             revs = [other.lookup(rev) for rev in revs]
@@ -2363,9 +2368,9 @@
     Please see 'hg help urls' for important details about ``ssh://``
     URLs. If DESTINATION is omitted, a default path will be used.
     """
-    dest, revs, checkout = hg.parseurl(
-        ui.expandpath(dest or 'default-push', dest or 'default'),
-        opts.get('rev'))
+    dest = ui.expandpath(dest or 'default-push', dest or 'default')
+    dest, branches = hg.parseurl(dest)
+    revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
     other = hg.repository(cmdutil.remoteui(repo, opts), dest)
     ui.status(_('pushing to %s\n') % url.hidepassword(dest))
     if revs: