Patchwork [3,of,7,v4] rebase: move local variable 'skipped' to the RRS class

login
register
mail settings
Submitter Kostia Balytskyi
Date June 5, 2016, 5:46 p.m.
Message ID <938164b4fd698dc3b176.1465148777@ikostia-mbp>
Download mbox | patch
Permalink /patch/15412/
State Superseded
Headers show

Comments

Kostia Balytskyi - June 5, 2016, 5:46 p.m.
# HG changeset patch
# User Kostia Balytskyi <ikostia@fb.com>
# Date 1465135652 -3600
#      Sun Jun 05 15:07:32 2016 +0100
# Node ID 938164b4fd698dc3b176a91467f3d719cfa3625a
# Parent  3451dc2597880ab34b41fecfc64fb123a08ae356
rebase: move local variable 'skipped' to the RRS class

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -130,6 +130,7 @@  class RebaseRuntimeState(object):
         self.state = {}
         self.activebookmark = None
         self.target = None
+        self.skipped = set()
 
 @command('rebase',
     [('s', 'source', '',
@@ -242,7 +243,6 @@  def rebase(ui, repo, **opts):
 
     """
     rtstate = RebaseRuntimeState()
-    skipped = set()
     targetancestors = set()
 
 
@@ -302,9 +302,9 @@  def rebase(ui, repo, **opts):
                 ui.warn(_('tool option will be ignored\n'))
 
             try:
-                (rtstate.originalwd, rtstate.target, rtstate.state, skipped,
-                 collapsef, keepf, keepbranchesf, rtstate.external,
-                 rtstate.activebookmark) = restorestatus(repo)
+                (rtstate.originalwd, rtstate.target, rtstate.state,
+                 rtstate.skipped, collapsef, keepf, keepbranchesf,
+                 rtstate.external, rtstate.activebookmark) = restorestatus(repo)
                 collapsemsg = restorecollapsemsg(repo)
             except error.RepoLookupError:
                 if abortf:
@@ -470,7 +470,7 @@  def rebase(ui, repo, **opts):
                     if not collapsef:
                         ui.warn(_('note: rebase of %d:%s created no changes '
                                   'to commit\n') % (rev, ctx))
-                        skipped.add(rev)
+                        rtstate.skipped.add(rev)
                     rtstate.state[rev] = p1
                     ui.debug('next revision set to %s\n' % p1)
             elif rtstate.state[rev] == nullmerge:
@@ -504,7 +504,7 @@  def rebase(ui, repo, **opts):
             else:
                 commitmsg = 'Collapsed revision'
                 for rebased in rtstate.state:
-                    if rebased not in skipped and\
+                    if rebased not in rtstate.skipped and\
                        rtstate.state[rebased] > nullmerge:
                         commitmsg += '\n* %s' % repo[rebased].description()
                 editopt = True
@@ -523,7 +523,7 @@  def rebase(ui, repo, **opts):
                     rtstate.state[oldrev] = newrev
 
         if 'qtip' in repo.tags():
-            updatemq(repo, rtstate.state, skipped, **opts)
+            updatemq(repo, rtstate.state, rtstate.skipped, **opts)
 
         if currentbookmarks:
             # Nodeids are needed to reset bookmarks
@@ -549,7 +549,7 @@  def rebase(ui, repo, **opts):
             collapsedas = None
             if collapsef:
                 collapsedas = newnode
-            clearrebased(ui, repo, rtstate.state, skipped, collapsedas)
+            clearrebased(ui, repo, rtstate.state, rtstate.skipped, collapsedas)
 
         with repo.transaction('bookmark') as tr:
             if currentbookmarks:
@@ -562,8 +562,9 @@  def rebase(ui, repo, **opts):
 
         ui.note(_("rebase completed\n"))
         util.unlinkpath(repo.sjoin('undo'), ignoremissing=True)
-        if skipped:
-            ui.note(_("%d revisions have been skipped\n") % len(skipped))
+        if rtstate.skipped:
+            skippedlen = len(rtstate.skipped)
+            ui.note(_("%d revisions have been skipped\n") % skippedlen)
 
         if (rtstate.activebookmark and
             repo['.'].node() == repo._bookmarks[rtstate.activebookmark]):