changeset 29404:591a8069b60e

rebase: move local variable 'obsoletenotrebased' to the RR class
author Kostia Balytskyi <ikostia@fb.com>
date Tue, 21 Jun 2016 06:29:23 -0700
parents b95fd7c15b7c
children fbe380dc227a
files hgext/rebase.py
diffstat 1 files changed, 14 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Tue Jun 21 06:29:23 2016 -0700
+++ b/hgext/rebase.py	Tue Jun 21 06:29:23 2016 -0700
@@ -153,6 +153,7 @@
         # keepopen is not meant for use on the command line, but by
         # other extensions
         self.keepopen = opts.get('keepopen', False)
+        self.obsoletenotrebased = {}
 
     def restorestatus(self):
         """Restore a previously stored status"""
@@ -399,15 +400,15 @@
                              rbsrt.state,
                              activebookmark=rbsrt.activebookmark)
 
-            obsoletenotrebased = {}
+            rbsrt.obsoletenotrebased = {}
             if ui.configbool('experimental', 'rebaseskipobsolete',
                              default=True):
                 rebaseobsrevs = set([r for r, st in rbsrt.state.items()
                                      if st == revprecursor])
                 rebasesetrevs = set(rbsrt.state.keys())
-                obsoletenotrebased = _computeobsoletenotrebased(repo,
-                                        rebaseobsrevs, rbsrt.target)
-                rebaseobsskipped = set(obsoletenotrebased)
+                rbsrt.obsoletenotrebased = _computeobsoletenotrebased(repo,
+                                                rebaseobsrevs, rbsrt.target)
+                rebaseobsskipped = set(rbsrt.obsoletenotrebased)
                 _checkobsrebase(repo, ui, rebaseobsrevs, rebasesetrevs,
                                 rebaseobsskipped)
         else:
@@ -425,21 +426,21 @@
                       " unrebased descendants"),
                     hint=_('use --keep to keep original changesets'))
 
-            obsoletenotrebased = {}
+            rbsrt.obsoletenotrebased = {}
             if ui.configbool('experimental', 'rebaseskipobsolete',
                              default=True):
                 rebasesetrevs = set(rebaseset)
                 rebaseobsrevs = _filterobsoleterevs(repo, rebasesetrevs)
-                obsoletenotrebased = _computeobsoletenotrebased(repo,
+                rbsrt.obsoletenotrebased = _computeobsoletenotrebased(repo,
                                                                 rebaseobsrevs,
                                                                 dest)
-                rebaseobsskipped = set(obsoletenotrebased)
+                rebaseobsskipped = set(rbsrt.obsoletenotrebased)
                 _checkobsrebase(repo, ui, rebaseobsrevs,
                                               rebasesetrevs,
                                               rebaseobsskipped)
 
             result = buildstate(repo, dest, rebaseset, rbsrt.collapsef,
-                                obsoletenotrebased)
+                                rbsrt.obsoletenotrebased)
 
             if not result:
                 # Empty state built, nothing to rebase
@@ -506,7 +507,7 @@
                 p1, p2, base = defineparents(repo, rev, rbsrt.target,
                                              rbsrt.state,
                                              rbsrt.targetancestors,
-                                             obsoletenotrebased)
+                                             rbsrt.obsoletenotrebased)
                 storestatus(repo, rbsrt.originalwd, rbsrt.target,
                             rbsrt.state, rbsrt.collapsef, rbsrt.keepf,
                             rbsrt.keepbranchesf, rbsrt.external,
@@ -556,7 +557,7 @@
             elif rbsrt.state[rev] == revignored:
                 ui.status(_('not rebasing ignored %s\n') % desc)
             elif rbsrt.state[rev] == revprecursor:
-                targetctx = repo[obsoletenotrebased[rev]]
+                targetctx = repo[rbsrt.obsoletenotrebased[rev]]
                 desctarget = '%d:%s "%s"' % (targetctx.rev(), targetctx,
                              targetctx.description().split('\n', 1)[0])
                 msg = _('note: not rebasing %s, already in destination as %s\n')
@@ -575,7 +576,7 @@
             p1, p2, _base = defineparents(repo, min(rbsrt.state),
                                           rbsrt.target, rbsrt.state,
                                           rbsrt.targetancestors,
-                                          obsoletenotrebased)
+                                          rbsrt.obsoletenotrebased)
             editopt = opts.get('edit')
             editform = 'rebase.collapse'
             if rbsrt.collapsemsg:
@@ -611,7 +612,7 @@
                 if v > nullmerge:
                     nstate[repo[k].node()] = repo[v].node()
                 elif v == revprecursor:
-                    succ = obsoletenotrebased[k]
+                    succ = rbsrt.obsoletenotrebased[k]
                     nstate[repo[k].node()] = repo[succ].node()
             # XXX this is the same as dest.node() for the non-continue path --
             # this should probably be cleaned up
@@ -621,7 +622,7 @@
         # (we do this before stripping)
         newwd = rbsrt.state.get(rbsrt.originalwd, rbsrt.originalwd)
         if newwd == revprecursor:
-            newwd = obsoletenotrebased[rbsrt.originalwd]
+            newwd = rbsrt.obsoletenotrebased[rbsrt.originalwd]
         elif newwd < 0:
             # original directory is a parent of rebase set root or ignored
             newwd = rbsrt.originalwd