merge: add ancestor to the update function
authorMatt Mackall <mpm@selenic.com>
Mon, 04 Apr 2011 15:25:20 -0500
changeset 13874 9d67277c9204
parent 13873 02c3d4d44a92
child 13875 ff3c683eb8ff
merge: add ancestor to the update function This makes it easier to do rebase-like operations.
mercurial/merge.py
--- a/mercurial/merge.py	Mon Apr 04 14:21:54 2011 -0500
+++ b/mercurial/merge.py	Mon Apr 04 15:25:20 2011 -0500
@@ -439,7 +439,7 @@
                 if f:
                     repo.dirstate.forget(f)
 
-def update(repo, node, branchmerge, force, partial):
+def update(repo, node, branchmerge, force, partial, ancestor=None):
     """
     Perform a merge between the working directory and the given node
 
@@ -492,7 +492,11 @@
         overwrite = force and not branchmerge
         pl = wc.parents()
         p1, p2 = pl[0], repo[node]
-        pa = p1.ancestor(p2)
+        if ancestor:
+            pa = repo[ancestor]
+        else:
+            pa = p1.ancestor(p2)
+
         fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)
 
         ### check phase