hgext/rebase.py
changeset 9815 49efeed49c94
parent 9599 f3404b7f37ca
child 10263 25e572394f5c
--- a/hgext/rebase.py	Fri Nov 06 10:06:08 2009 +0100
+++ b/hgext/rebase.py	Mon Nov 09 20:15:49 2009 +0100
@@ -27,17 +27,19 @@
     oldancestor = ancestor.ancestor
 
     def newancestor(a, b, pfunc):
-        ancestor.ancestor = oldancestor
         if b == rev:
             return repo[rev].parents()[0].rev()
-        return ancestor.ancestor(a, b, pfunc)
+        return oldancestor(a, b, pfunc)
 
     if not first:
         ancestor.ancestor = newancestor
     else:
         repo.ui.debug("first revision, do not change ancestor\n")
-    stats = merge.update(repo, rev, True, True, False)
-    return stats
+    try:
+        stats = merge.update(repo, rev, True, True, False)
+        return stats
+    finally:
+        ancestor.ancestor = oldancestor
 
 def rebase(ui, repo, **opts):
     """move changeset (and descendants) to a different branch