pull -r: pass the revisions as the heads argument of findincoming
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Mon, 27 Aug 2007 01:44:35 -0300
changeset 5221 8ede77c2d008
parent 5220 9d7052f17d77
child 5222 cbe6e263357b
pull -r: pass the revisions as the heads argument of findincoming This can make a hg pull -r faster if the remote repo has many heads, and fixes an "abort: received changelog group is empty".
mercurial/localrepo.py
tests/test-pull-r
tests/test-pull-r.out
--- a/mercurial/localrepo.py	Sun Aug 26 19:05:19 2007 +0200
+++ b/mercurial/localrepo.py	Mon Aug 27 01:44:35 2007 -0300
@@ -1312,7 +1312,7 @@
             mylock = True
 
         try:
-            fetch = self.findincoming(remote, force=force)
+            fetch = self.findincoming(remote, heads=heads, force=force)
             if fetch == [nullid]:
                 self.ui.status(_("requesting all changes\n"))
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-pull-r	Mon Aug 27 01:44:35 2007 -0300
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+hg init repo
+cd repo
+echo foo > foo
+hg ci -qAm 'add foo' -d '0 0'
+echo >> foo
+hg ci -m 'change foo' -d '0 0'
+hg up -qC 0
+echo bar > bar
+hg ci -qAm 'add bar' -d '0 0'
+hg log
+cd ..
+hg init copy
+cd copy
+
+echo '% pull -r 0'
+hg pull -qr 0 ../repo
+hg log
+
+echo '% pull -r 1'
+hg pull -qr 1 ../repo
+hg log
+
+# this used to abort: received changelog group is empty
+echo '% pull -r 1 again'
+hg pull -qr 1 ../repo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-pull-r.out	Mon Aug 27 01:44:35 2007 -0300
@@ -0,0 +1,37 @@
+changeset:   2:effea6de0384
+tag:         tip
+parent:      0:bbd179dfa0a7
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add bar
+
+changeset:   1:ed1b79f46b9a
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     change foo
+
+changeset:   0:bbd179dfa0a7
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add foo
+
+% pull -r 0
+changeset:   0:bbd179dfa0a7
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add foo
+
+% pull -r 1
+changeset:   1:ed1b79f46b9a
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     change foo
+
+changeset:   0:bbd179dfa0a7
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add foo
+
+% pull -r 1 again