[PATCH 14 of 16] rebase: move obsoletenotrebased local variable to rebase runtime object

Kostia Balytskyi ikostia at fb.com
Sun May 29 18:38:45 EDT 2016


# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1464549548 -3600
#      Sun May 29 20:19:08 2016 +0100
# Node ID d1d265c63070dccdc17c10885fb8b3833c29cdef
# Parent  3db4f209833e81cb044098330755787db4112157
rebase: move obsoletenotrebased local variable to rebase runtime object

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -165,6 +165,7 @@
         # keepopen is not meant for use on the command line, but by
         # other extensions
         self.keepopen = opts.get('keepopen', False)
+        self.obsoletenotrebased = {}
 
     def validateoptions(self):
         if self.opts.get('interactive'):
@@ -404,15 +405,15 @@
                              rtstate.state,
                              activebookmark=rtstate.activebookmark)
 
-            obsoletenotrebased = {}
+            rtstate.obsoletenotrebased = {}
             if ui.configbool('experimental', 'rebaseskipobsolete',
                              default=True):
                 rebaseobsrevs = set([r for r, st in rtstate.state.items()
                                      if st == revprecursor])
                 rebasesetrevs = set(rtstate.state.keys())
-                obsoletenotrebased = _computeobsoletenotrebased(repo,
-                                        rebaseobsrevs, rtstate.target)
-                rebaseobsskipped = set(obsoletenotrebased)
+                rtstate.obsoletenotrebased = _computeobsoletenotrebased(repo,
+                                                rebaseobsrevs, rtstate.target)
+                rebaseobsskipped = set(rtstate.obsoletenotrebased)
                 _checkobsrebase(repo, ui, rebaseobsrevs, rebasesetrevs,
                                 rebaseobsskipped)
         else:
@@ -431,21 +432,21 @@
                       " unrebased descendants"),
                     hint=_('use --keep to keep original changesets'))
 
-            obsoletenotrebased = {}
+            rtstate.obsoletenotrebased = {}
             if ui.configbool('experimental', 'rebaseskipobsolete',
                              default=True):
                 rebasesetrevs = set(rebaseset)
                 rebaseobsrevs = _filterobsoleterevs(repo, rebasesetrevs)
-                obsoletenotrebased = _computeobsoletenotrebased(repo,
+                rtstate.obsoletenotrebased = _computeobsoletenotrebased(repo,
                                                                 rebaseobsrevs,
                                                                 dest)
-                rebaseobsskipped = set(obsoletenotrebased)
+                rebaseobsskipped = set(rtstate.obsoletenotrebased)
                 _checkobsrebase(repo, ui, rebaseobsrevs,
                                               rebasesetrevs,
                                               rebaseobsskipped)
 
             result = buildstate(repo, dest, rebaseset, rtstate.collapsef,
-                                obsoletenotrebased)
+                                rtstate.obsoletenotrebased)
 
             if not result:
                 # Empty state built, nothing to rebase
@@ -513,7 +514,7 @@
                 p1, p2, base = defineparents(repo, rev, rtstate.target,
                                              rtstate.state,
                                              rtstate.targetancestors,
-                                             obsoletenotrebased)
+                                             rtstate.obsoletenotrebased)
                 storestatus(repo, rtstate.originalwd, rtstate.target,
                             rtstate.state, rtstate.collapsef, rtstate.keepf,
                             rtstate.keepbranchesf, rtstate.external,
@@ -563,7 +564,7 @@
             elif rtstate.state[rev] == revignored:
                 ui.status(_('not rebasing ignored %s\n') % desc)
             elif rtstate.state[rev] == revprecursor:
-                targetctx = repo[obsoletenotrebased[rev]]
+                targetctx = repo[rtstate.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')
@@ -582,7 +583,7 @@
             p1, p2, _base = defineparents(repo, min(rtstate.state),
                                           rtstate.target, rtstate.state,
                                           rtstate.targetancestors,
-                                          obsoletenotrebased)
+                                          rtstate.obsoletenotrebased)
             editopt = opts.get('edit')
             editform = 'rebase.collapse'
             if rtstate.collapsemsg:


More information about the Mercurial-devel mailing list