changeset 10358:d42821cd5c96

pull: with -u and -r, update to the first revision given This makes pull consistent with clone. The actual change is in mercurial.hg.parseurl, changing its checkout result, which is only used for pull.
author Sune Foldager <cryo@cyanite.org>
date Sat, 06 Feb 2010 20:24:51 +0100
parents 0d64b30b35c3
children ec02cf8d1628
files mercurial/hg.py tests/test-pull-r tests/test-pull-r.out
diffstat 3 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Sun Feb 07 10:01:55 2010 +0100
+++ b/mercurial/hg.py	Sat Feb 06 20:24:51 2010 +0100
@@ -22,10 +22,10 @@
     '''parse url#branch, returning url, branch + revs'''
 
     if '#' not in url:
-        return url, (revs or None), revs and revs[-1] or None
+        return url, (revs or None), revs and revs[0] or None
 
     url, branch = url.split('#', 1)
-    checkout = revs and revs[-1] or branch
+    checkout = revs and revs[0] or branch
     return url, (revs or []) + [branch], checkout
 
 schemes = {
@@ -188,7 +188,7 @@
     else:
         src_repo = source
         origsource = source = src_repo.url()
-        checkout = rev and rev[-1] or None
+        checkout = rev and rev[0] or None
 
     if dest is None:
         dest = defaultdest(source)
--- a/tests/test-pull-r	Sun Feb 07 10:01:55 2010 +0100
+++ b/tests/test-pull-r	Sat Feb 06 20:24:51 2010 +0100
@@ -17,6 +17,11 @@
 echo '% pull a missing revision'
 hg pull -qr missing ../repo
 
+echo '% pull multiple revisions with update'
+hg pull -qu -r 0 -r 1 ../repo
+hg -q parents
+hg rollback
+
 echo '% pull -r 0'
 hg pull -qr 0 ../repo
 hg log
--- a/tests/test-pull-r.out	Sun Feb 07 10:01:55 2010 +0100
+++ b/tests/test-pull-r.out	Sat Feb 06 20:24:51 2010 +0100
@@ -17,6 +17,9 @@
 
 % pull a missing revision
 abort: unknown revision 'missing'!
+% pull multiple revisions with update
+0:bbd179dfa0a7
+rolling back last transaction
 % pull -r 0
 changeset:   0:bbd179dfa0a7
 tag:         tip