hgext/rebase.py
changeset 29361 8a080faba2eb
parent 29360 4cbe62ab5c97
child 29372 0b5e9a625042
--- a/hgext/rebase.py	Mon Jun 13 22:40:59 2016 +0100
+++ b/hgext/rebase.py	Mon Jun 13 22:41:45 2016 +0100
@@ -131,6 +131,7 @@
         self.activebookmark = None
         self.target = None
         self.skipped = set()
+        self.targetancestors = set()
 
 @command('rebase',
     [('s', 'source', '',
@@ -243,8 +244,6 @@
 
     """
     rbsrt = rebaseruntime()
-    targetancestors = set()
-
 
     lock = wlock = None
     try:
@@ -377,10 +376,10 @@
 
             (rbsrt.originalwd, rbsrt.target, rbsrt.state) = result
             if collapsef:
-                targetancestors = repo.changelog.ancestors([rbsrt.target],
-                                                           inclusive=True)
+                rbsrt.targetancestors = repo.changelog.ancestors([rbsrt.target],
+                                                                 inclusive=True)
                 rbsrt.external = externalparent(repo, rbsrt.state,
-                                                       targetancestors)
+                                                rbsrt.targetancestors)
 
             if dest.closesbranch() and not keepbranchesf:
                 ui.status(_('reopening closed branch head %s\n') % dest)
@@ -399,9 +398,9 @@
                             'branches'))
 
         # Rebase
-        if not targetancestors:
-            targetancestors = repo.changelog.ancestors([rbsrt.target],
-                                                       inclusive=True)
+        if not rbsrt.targetancestors:
+            rbsrt.targetancestors = repo.changelog.ancestors([rbsrt.target],
+                                                             inclusive=True)
 
         # Keep track of the current bookmarks in order to reset them later
         currentbookmarks = repo._bookmarks.copy()
@@ -428,7 +427,7 @@
                             _('changesets'), total)
                 p1, p2, base = defineparents(repo, rev, rbsrt.target,
                                              rbsrt.state,
-                                             targetancestors,
+                                             rbsrt.targetancestors,
                                              obsoletenotrebased)
                 storestatus(repo, rbsrt.originalwd, rbsrt.target,
                             rbsrt.state, collapsef, keepf, keepbranchesf,
@@ -496,7 +495,8 @@
         if collapsef and not keepopen:
             p1, p2, _base = defineparents(repo, min(rbsrt.state),
                                           rbsrt.target, rbsrt.state,
-                                          targetancestors, obsoletenotrebased)
+                                          rbsrt.targetancestors,
+                                          obsoletenotrebased)
             editopt = opts.get('edit')
             editform = 'rebase.collapse'
             if collapsemsg: