[PATCH 06 of 16] rebase: move destspace, contf and abortf local variables to an object

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


# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1464524676 -3600
#      Sun May 29 13:24:36 2016 +0100
# Node ID c2e2b9b13815f2b6b40936f93f67635283c429f1
# Parent  720b6ff9d72c707bf108212e9e6f5969e2ff566e
rebase: move destspace, contf and abortf local variables to an object

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -139,6 +139,12 @@
         self.basef = opts.get('base', None)
         self.revf = opts.get('rev', [])
 
+        # search default destination in this space
+        # used in the 'hg pull --rebase' case, see issue 5214.
+        self.destspace = opts.get('_destspace')
+        self.contf = opts.get('continue')
+        self.abortf = opts.get('abort')
+
 @command('rebase',
     [('s', 'source', '',
      _('rebase the specified changeset and descendants'), _('REV')),
@@ -256,11 +262,6 @@
         wlock = repo.wlock()
         lock = repo.lock()
 
-        # search default destination in this space
-        # used in the 'hg pull --rebase' case, see issue 5214.
-        destspace = opts.get('_destspace')
-        contf = opts.get('continue')
-        abortf = opts.get('abort')
         collapsef = opts.get('collapse', False)
         collapsemsg = cmdutil.logmessage(ui, opts)
         date = opts.get('date', None)
@@ -289,8 +290,8 @@
             raise error.Abort(
                 _('message can only be specified with collapse'))
 
-        if contf or abortf:
-            if contf and abortf:
+        if rtstate.contf or rtstate.abortf:
+            if rtstate.contf and rtstate.abortf:
                 raise error.Abort(_('cannot use both abort and continue'))
             if collapsef:
                 raise error.Abort(
@@ -298,7 +299,7 @@
             if rtstate.srcf or rtstate.basef or rtstate.destf:
                 raise error.Abort(
                     _('abort and continue do not allow specifying revisions'))
-            if abortf and opts.get('tool', False):
+            if rtstate.abortf and opts.get('tool', False):
                 ui.warn(_('tool option will be ignored\n'))
 
             try:
@@ -307,7 +308,7 @@
                  rtstate.external, rtstate.activebookmark) = restorestatus(repo)
                 collapsemsg = restorecollapsemsg(repo)
             except error.RepoLookupError:
-                if abortf:
+                if rtstate.abortf:
                     clearstatus(repo)
                     clearcollapsemsg(repo)
                     repo.ui.warn(_('rebase aborted (no revision is removed,'
@@ -317,7 +318,7 @@
                     msg = _('cannot continue inconsistent rebase')
                     hint = _('use "hg rebase --abort" to clear broken state')
                     raise error.Abort(msg, hint=hint)
-            if abortf:
+            if rtstate.abortf:
                 return abort(repo, rtstate.originalwd, rtstate.target,
                              rtstate.state,
                              activebookmark=rtstate.activebookmark)
@@ -336,7 +337,7 @@
         else:
             dest, rebaseset = _definesets(ui, repo, rtstate.destf, rtstate.srcf,
                                           rtstate.basef, rtstate.revf,
-                                          destspace=destspace)
+                                          destspace=rtstate.destspace)
             if dest is None:
                 return _nothingtorebase()
 


More information about the Mercurial-devel mailing list