changeset 13875:ff3c683eb8ff

rebase: use merge's ancestor parameter
author Matt Mackall <mpm@selenic.com>
date Mon, 04 Apr 2011 15:30:54 -0500
parents 9d67277c9204
children 10c7d92ac482
files hgext/rebase.py
diffstat 1 files changed, 4 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Mon Apr 04 15:25:20 2011 -0500
+++ b/hgext/rebase.py	Mon Apr 04 15:30:54 2011 -0500
@@ -234,25 +234,6 @@
     finally:
         release(lock, wlock)
 
-def rebasemerge(repo, rev, first=False):
-    'return the correct ancestor'
-    oldancestor = ancestor.ancestor
-
-    def newancestor(a, b, pfunc):
-        if b == rev:
-            return repo[rev].parents()[0].rev()
-        return oldancestor(a, b, pfunc)
-
-    if not first:
-        ancestor.ancestor = newancestor
-    else:
-        repo.ui.debug("first revision, do not change ancestor\n")
-    try:
-        stats = merge.update(repo, rev, True, True, False)
-        return stats
-    finally:
-        ancestor.ancestor = oldancestor
-
 def checkexternal(repo, state, targetancestors):
     """Check whether one or more external revisions need to be taken in
     consideration. In the latter case, abort.
@@ -317,9 +298,10 @@
         repo.ui.debug(" already in target\n")
     repo.dirstate.write()
     repo.ui.debug(" merge against %d:%s\n" % (repo[rev].rev(), repo[rev]))
-    first = repo[rev].rev() == repo[min(state)].rev()
-    stats = rebasemerge(repo, rev, first)
-    return stats
+    base = None
+    if repo[rev].rev() != repo[min(state)].rev():
+        base = repo[rev].parents()[0].node()
+    return merge.update(repo, rev, True, True, False, base)
 
 def defineparents(repo, rev, target, state, targetancestors):
     'Return the new parent relationship of the revision that will be rebased'