[PATCH 08 of 16] rebase: move date and extrafns local variables to an object
Kostia Balytskyi
ikostia at fb.com
Sun May 29 18:38:39 EDT 2016
# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1464526087 -3600
# Sun May 29 13:48:07 2016 +0100
# Node ID f15a1ec9e6d8c28d3ea7cfe3ea56f882cd19f603
# Parent c9893e4bf48f3fb8bdb7bbe792c895a318553116
rebase: move date and extrafns local variables to an object
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -146,6 +146,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', '',
@@ -264,11 +270,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
@@ -392,7 +393,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:
@@ -412,7 +413,7 @@
if rtstate.activebookmark:
bookmarks.deactivate(repo)
- extrafn = _makeextrafn(extrafns)
+ extrafn = _makeextrafn(rtstate.extrafns)
sortedstate = sorted(rtstate.state)
total = len(sortedstate)
@@ -459,7 +460,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()
@@ -518,7 +519,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