transplant: only pull the transplanted revision (issue4692) stable 3.4.2
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 29 Jun 2015 19:09:42 -0700
branchstable
changeset 25679 540cd0ddac49
parent 25678 0c201666fdc6
child 25680 606f09787af9
child 25695 ce3d4b858420
transplant: only pull the transplanted revision (issue4692) For some reason, transplant was pulling all remote revisions when transplanting from a remote repository (unless --branch was specified).
hgext/transplant.py
tests/test-transplant.t
--- a/hgext/transplant.py	Mon Jun 29 19:18:51 2015 -0700
+++ b/hgext/transplant.py	Mon Jun 29 19:09:42 2015 -0700
@@ -625,8 +625,14 @@
     if sourcerepo:
         peer = hg.peer(repo, opts, ui.expandpath(sourcerepo))
         heads = map(peer.lookup, opts.get('branch', ()))
+        target = set(heads)
+        for r in revs:
+            try:
+                target.add(peer.lookup(r))
+            except error.RepoError:
+                pass
         source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, peer,
-                                    onlyheads=heads, force=True)
+                                    onlyheads=sorted(target), force=True)
     else:
         source = repo
         heads = map(source.lookup, opts.get('branch', ()))
--- a/tests/test-transplant.t	Mon Jun 29 19:18:51 2015 -0700
+++ b/tests/test-transplant.t	Mon Jun 29 19:09:42 2015 -0700
@@ -313,13 +313,11 @@
   0  r1
 
 remote transplant without pull
-(I'm pretty sure this test is actually pulling,
-It was using "2" and "4" (as the previous transplant used to) which referenced
+(It was using "2" and "4" (as the previous transplant used to) which referenced
 revision different from one run to another)
 
   $ hg pull -q http://localhost:$HGPORT/
   $ hg transplant -s http://localhost:$HGPORT/ 8d9279348abb 722f4667af76
-  searching for changes
   skipping already applied revision 2:8d9279348abb
   applying 722f4667af76
   722f4667af76 transplanted to 76e321915884