D6551: state: moved cmdutil.afterresolvedstates to statemod
taapas1128 (Taapas Agrawal)
phabricator at mercurial-scm.org
Thu Jun 20 06:13:17 UTC 2019
taapas1128 created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This commit moves `cmdutil.afterresolvedstates` and
adjoining function to `state.py`. The existing users are
updated accordingly.
Tests remain unchanged.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D6551
AFFECTED FILES
hgext/histedit.py
hgext/rebase.py
hgext/shelve.py
mercurial/cmdutil.py
mercurial/state.py
CHANGE DETAILS
diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -252,3 +252,26 @@
continue
if state.isunfinished(repo):
return (state._opname, state.statusmsg())
+
+afterresolvedstates = [
+ ('graftstate',
+ _('hg graft --continue')),
+ ]
+
+def howtocontinue(repo):
+ '''Check for an unfinished operation and return the command to finish
+ it.
+
+ afterresolvedstates tuples define a .hg/{file} and the corresponding
+ command needed to finish it.
+
+ Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is
+ a boolean.
+ '''
+ contmsg = _("continue: %s")
+ for f, msg in afterresolvedstates:
+ if repo.vfs.exists(f):
+ return contmsg % msg, True
+ if repo[None].dirty(missing=True, merge=False, branch=False):
+ return contmsg % _("hg commit"), False
+ return None, None
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3258,29 +3258,6 @@
# - (desturl, destbranch, destpeer, outgoing)
summaryremotehooks = util.hooks()
-afterresolvedstates = [
- ('graftstate',
- _('hg graft --continue')),
- ]
-
-def howtocontinue(repo):
- '''Check for an unfinished operation and return the command to finish
- it.
-
- afterresolvedstates tuples define a .hg/{file} and the corresponding
- command needed to finish it.
-
- Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is
- a boolean.
- '''
- contmsg = _("continue: %s")
- for f, msg in afterresolvedstates:
- if repo.vfs.exists(f):
- return contmsg % msg, True
- if repo[None].dirty(missing=True, merge=False, branch=False):
- return contmsg % _("hg commit"), False
- return None, None
-
def checkafterresolved(repo):
'''Inform the user about the next action after completing hg resolve
@@ -3289,7 +3266,7 @@
Otherwise, it will yield repo.ui.note.
'''
- msg, warning = howtocontinue(repo)
+ msg, warning = statemod.howtocontinue(repo)
if msg is not None:
if warning:
repo.ui.warn("%s\n" % msg)
@@ -3305,7 +3282,7 @@
If there's no task (repo.ui.note for 'hg commit'), it does not offer
a hint.
'''
- after = howtocontinue(repo)
+ after = statemod.howtocontinue(repo)
hint = None
if after[1]:
hint = after[0]
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -1142,5 +1142,5 @@
'unshelve', fname=shelvedstate._filename,
cmdmsg=_('unshelve already in progress')
)
- cmdutil.afterresolvedstates.append(
+ statemod.afterresolvedstates.append(
[shelvedstate._filename, _('hg unshelve --continue')])
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1951,5 +1951,5 @@
_("specify merge tool for rebase")))
cmdutil.summaryhooks.add('rebase', summaryhook)
statemod.addunfinished('rebase', fname='rebasestate', stopflag=True)
- cmdutil.afterresolvedstates.append(
+ statemod.afterresolvedstates.append(
['rebasestate', _('hg rebase --continue')])
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -2314,5 +2314,5 @@
def extsetup(ui):
cmdutil.summaryhooks.add('histedit', summaryhook)
statemod.addunfinished('histedit', fname='histedit-state', allowcommit=True)
- cmdutil.afterresolvedstates.append(
+ statemod.afterresolvedstates.append(
['histedit-state', _('hg histedit --continue')])
To: taapas1128, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list