[PATCH 09 of 16] rebase: move keepf, keepbranchesf and keepopen local variables to an object
Kostia Balytskyi
ikostia at fb.com
Sun May 29 22:38:40 UTC 2016
# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1464547167 -3600
# Sun May 29 19:39:27 2016 +0100
# Node ID 97669ad5e4d47a509a636a4e915e189a49f90bc5
# Parent f15a1ec9e6d8c28d3ea7cfe3ea56f882cd19f603
rebase: move keepf, keepbranchesf and keepopen local variables to an object
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -153,6 +153,12 @@
if e:
self.extrafns = [e]
+ self.keepf = opts.get('keep', False)
+ self.keepbranchesf = opts.get('keepbranches', False)
+ # keepopen is not meant for use on the command line, but by
+ # other extensions
+ self.keepopen = opts.get('keepopen', False)
+
@command('rebase',
[('s', 'source', '',
_('rebase the specified changeset and descendants'), _('REV')),
@@ -270,12 +276,6 @@
wlock = repo.wlock()
lock = repo.lock()
- keepf = opts.get('keep', False)
- keepbranchesf = opts.get('keepbranches', False)
- # keepopen is not meant for use on the command line, but by
- # other extensions
- keepopen = opts.get('keepopen', False)
-
if opts.get('interactive'):
try:
if extensions.find('histedit'):
@@ -305,8 +305,9 @@
try:
(rtstate.originalwd, rtstate.target, rtstate.state,
- rtstate.skipped, rtstate.collapsef, keepf, keepbranchesf,
- rtstate.external, rtstate.activebookmark) = restorestatus(repo)
+ rtstate.skipped, rtstate.collapsef, rtstate.keepf,
+ rtstate.keepbranchesf, rtstate.external,
+ rtstate.activebookmark) = restorestatus(repo)
rtstate.collapsemsg = restorecollapsemsg(repo)
except error.RepoLookupError:
if rtstate.abortf:
@@ -343,7 +344,7 @@
return _nothingtorebase()
allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
- if (not (keepf or allowunstable)
+ if (not (rtstate.keepf or allowunstable)
and repo.revs('first(children(%ld) - %ld)',
rebaseset, rebaseset)):
raise error.Abort(
@@ -373,7 +374,7 @@
return _nothingtorebase()
root = min(rebaseset)
- if not keepf and not repo[root].mutable():
+ if not rtstate.keepf and not repo[root].mutable():
raise error.Abort(_("can't rebase public changeset %s")
% repo[root],
hint=_('see "hg help phases" for details'))
@@ -386,10 +387,10 @@
rtstate.external = externalparent(repo, rtstate.state,
rtstate.targetancestors)
- if dest.closesbranch() and not keepbranchesf:
+ if dest.closesbranch() and not rtstate.keepbranchesf:
ui.status(_('reopening closed branch head %s\n') % dest)
- if keepbranchesf:
+ if rtstate.keepbranchesf:
# insert _savebranch at the start of extrafns so if
# there's a user-provided extrafn it can clobber branch if
# desired
@@ -435,8 +436,8 @@
rtstate.targetancestors,
obsoletenotrebased)
storestatus(repo, rtstate.originalwd, rtstate.target,
- rtstate.state, rtstate.collapsef, keepf,
- keepbranchesf, rtstate.external,
+ rtstate.state, rtstate.collapsef, rtstate.keepf,
+ rtstate.keepbranchesf, rtstate.external,
rtstate.activebookmark)
storecollapsemsg(repo, rtstate.collapsemsg)
if len(repo[None].parents()) == 2:
@@ -459,7 +460,7 @@
editor = cmdutil.getcommiteditor(editform=editform, **opts)
newnode = concludenode(repo, rev, p1, p2, extrafn=extrafn,
editor=editor,
- keepbranches=keepbranchesf,
+ keepbranches=rtstate.keepbranchesf,
date=rtstate.date)
else:
# Skip commit if we are collapsing
@@ -498,7 +499,7 @@
ui.progress(_('rebasing'), None)
ui.note(_('rebase merging completed\n'))
- if rtstate.collapsef and not keepopen:
+ if rtstate.collapsef and not rtstate.keepopen:
p1, p2, _base = defineparents(repo, min(rtstate.state),
rtstate.target, rtstate.state,
rtstate.targetancestors,
@@ -518,7 +519,7 @@
newnode = concludenode(repo, rev, p1, rtstate.external,
commitmsg=commitmsg,
extrafn=extrafn, editor=editor,
- keepbranches=keepbranchesf,
+ keepbranches=rtstate.keepbranchesf,
date=rtstate.date)
if newnode is None:
newrev = rtstate.target
@@ -551,7 +552,7 @@
ui.note(_("update back to initial working directory parent\n"))
hg.updaterepo(repo, newwd, False)
- if not keepf:
+ if not rtstate.keepf:
collapsedas = None
if rtstate.collapsef:
collapsedas = newnode
More information about the Mercurial-devel
mailing list