[PATCH 09 of 23 v3] rebase: move local variables 'date' and 'extrafns' to the RRS class
Kostia Balytskyi
ikostia at fb.com
Thu Jun 2 10:13:50 EDT 2016
# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1464868928 -3600
# Thu Jun 02 13:02:08 2016 +0100
# Node ID 7c29b7287e5ba89e262bbd51e980eff4ffd706a1
# Parent 1f415cd0c3f945a833f57c83d1f3d3cfeb3347a3
rebase: move local variables 'date' and 'extrafns' to the RRS class
This commit moves the following variables, local to the rebase function to be
fields of the RebaseRuntimeState:
-date
-extrafns
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -151,6 +151,12 @@
self.abortf = opts.get('abort')
self.collapsef = opts.get('collapse', False)
self.collapsemsg = cmdutil.logmessage(ui, opts)
+ self.date = opts.get('date', None)
+
+ e = opts.get('extrafn') # internal, used by e.g. hgsubversion
+ self.extrafns = [_savegraft]
+ if e:
+ self.extrafns = [e]
@command('rebase',
[('s', 'source', '',
@@ -269,11 +275,6 @@
wlock = repo.wlock()
lock = repo.lock()
- date = opts.get('date', None)
- e = opts.get('extrafn') # internal, used by e.g. hgsubversion
- extrafns = [_savegraft]
- if e:
- extrafns = [e]
keepf = opts.get('keep', False)
keepbranchesf = opts.get('keepbranches', False)
# keepopen is not meant for use on the command line, but by
@@ -397,7 +398,7 @@
# insert _savebranch at the start of extrafns so if
# there's a user-provided extrafn it can clobber branch if
# desired
- extrafns.insert(0, _savebranch)
+ rtstate.extrafns.insert(0, _savebranch)
if rtstate.collapsef:
branches = set()
for rev in rtstate.state:
@@ -417,7 +418,7 @@
if rtstate.activebookmark:
bookmarks.deactivate(repo)
- extrafn = _makeextrafn(extrafns)
+ extrafn = _makeextrafn(rtstate.extrafns)
sortedstate = sorted(rtstate.state)
total = len(sortedstate)
@@ -464,7 +465,7 @@
newnode = concludenode(repo, rev, p1, p2, extrafn=extrafn,
editor=editor,
keepbranches=keepbranchesf,
- date=date)
+ date=rtstate.date)
else:
# Skip commit if we are collapsing
repo.dirstate.beginparentchange()
@@ -523,7 +524,7 @@
commitmsg=commitmsg,
extrafn=extrafn, editor=editor,
keepbranches=keepbranchesf,
- date=date)
+ date=rtstate.date)
if newnode is None:
newrev = rtstate.target
else:
More information about the Mercurial-devel
mailing list