Patchwork [6,of,6,v7] rebase: move local variable 'obsoletenotrebased' to the RR class

login
register
mail settings
Submitter Kostia Balytskyi
Date June 21, 2016, 2:28 p.m.
Message ID <213361c3ffa748dae78d.1466519312@dev1902.lla1.facebook.com>
Download mbox | patch
Permalink /patch/15562/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Kostia Balytskyi - June 21, 2016, 2:28 p.m.
# HG changeset patch
# User Kostia Balytskyi <ikostia@fb.com>
# Date 1466515763 25200
#      Tue Jun 21 06:29:23 2016 -0700
# Node ID 213361c3ffa748dae78d2e68dc6b188ccb3d1624
# Parent  2143c2f93af6c122f65229fa014f10260f3eaf63
rebase: move local variable 'obsoletenotrebased' to the RR class

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -153,6 +153,7 @@  class rebaseruntime(object):
         # 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 @@  def rebase(ui, repo, **opts):
                              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 @@  def rebase(ui, repo, **opts):
                       " 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 @@  def rebase(ui, repo, **opts):
                 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 @@  def rebase(ui, repo, **opts):
             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 @@  def rebase(ui, repo, **opts):
             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 @@  def rebase(ui, repo, **opts):
                 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 @@  def rebase(ui, repo, **opts):
         # (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