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

login
register
mail settings
Submitter Mads Kiilerich
Date April 7, 2014, 9:18 p.m.
Message ID <9dc50181e9a9ee73abaa.1396905501@mk-desktop>
Download mbox | patch
Permalink /patch/4260/
State Accepted
Commit 8c2f1e2a11ff2dd87f920b19f56ca06441fa294a
Headers show

Comments

Mads Kiilerich - April 7, 2014, 9:18 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@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.

Patch

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