[PATCH 5 of 8 ancestor-ish] transplant: use context ancestor instead of changelog ancestor

Mads Kiilerich mads at kiilerich.com
Mon Apr 7 16:18:21 CDT 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1396905471 -7200
#      Mon Apr 07 23:17:51 2014 +0200
# Node ID 9dc50181e9a9ee73abaa0d630ab639b8042d6585
# Parent  5b26b4e1f0815671b336bbe8680361ede2e8473b
transplant: use context ancestor instead of changelog ancestor

We want to move in this direction. ctx.ancestor is in a better position for
handling a situation with multiple ancestors.

diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -568,8 +568,9 @@ def transplant(ui, repo, *revs, **opts):
         if not heads:
             heads = repo.heads()
         ancestors = []
+        ctx = repo[dest]
         for head in heads:
-            ancestors.append(repo.changelog.ancestor(dest, head))
+            ancestors.append(ctx.ancestor(repo[head]).node())
         for node in repo.changelog.nodesbetween(ancestors, heads)[0]:
             if match(node):
                 yield node


More information about the Mercurial-devel mailing list