taapas1128 updated this revision to Diff 15629.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6552?vs=15615&id=15629

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6552/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6552

AFFECTED FILES
  hgext/histedit.py
  hgext/rebase.py
  hgext/shelve.py
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -98,8 +98,8 @@
     """
 
     def __init__(self, opname, fname, clearable=False, allowcommit=False,
-                 reportonly=False, cmdmsg="", cmdhint="", statushint="",
-                 stopflag=False):
+                 reportonly=False, continueflag=False, stopflag=False ,
+                 cmdmsg="", cmdhint="", statushint=""):
         """opname is the name the command or operation
         fname is the file name in which data should be stored in .hg directory.
         It is None for merge command.
@@ -111,6 +111,10 @@
         reportonly flag is used for operations like bisect where we just
         need to detect the operation using 'hg status --verbose'
         cmdmsg is used to pass a different status message in case standard
+        continueflag is a boolean determines whether or not a command supports
+        `--continue` option or not.
+        stopflag is a boolean that determines whether or not a command supports
+        --stop flag
         message of the format "abort: cmdname in progress" is not desired.
         cmdhint is used to pass a different hint message in case standard
         message of the format "To continue: hg cmdname --continue
@@ -118,8 +122,6 @@
         status hint is used to pass a different status message in case standard
         message of the format ('To continue:    hg cmdname --continue'
         'To abort:       hg cmdname --abort') is not desired
-        stopflag is a boolean that determines whether or not a command supports
-        --stop flag
         reportonly flag is used for operations like bisect where we just
         need to detect the operation using 'hg status --verbose'
         """
@@ -132,6 +134,7 @@
         self._cmdmsg = cmdmsg
         self._stopflag = stopflag
         self._reportonly = reportonly
+        self._continueflag = continueflag
 
     def statusmsg(self):
         """returns the hint message corresponding to the command for
@@ -162,6 +165,10 @@
             return _('%s in progress') % (self._opname)
         return self._cmdmsg
 
+    def continuemsg(self):
+        """ returns appropriate continue message corresponding to command"""
+        return _('hg %s --continue') % (self._opname)
+
     def isunfinished(self, repo):
         """determines whether a multi-step operation is in progress
         or not
@@ -185,7 +192,8 @@
 
 addunfinished(
     'graft', fname='graftstate', clearable=True, stopflag=True,
-    cmdhint=_("use 'hg graft --continue' or 'hg graft --stop' to stop"),
+    continueflag=True,
+    cmdhint=_("use 'hg graft --continue' or 'hg graft --stop' to stop")
 )
 addunfinished(
     'update', fname='updatestate', clearable=True,
@@ -253,11 +261,6 @@
         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.
@@ -269,9 +272,11 @@
     a boolean.
     '''
     contmsg = _("continue: %s")
-    for f, msg in afterresolvedstates:
-        if repo.vfs.exists(f):
-            return contmsg % msg, True
+    for state in _unfinishedstates:
+        if not state._continueflag:
+            continue
+        if state.isunfinished(repo):
+            return contmsg % state.continuemsg(), True
     if repo[None].dirty(missing=True, merge=False, branch=False):
         return contmsg % _("hg commit"), False
     return None, None
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -1139,8 +1139,7 @@
 
 def extsetup(ui):
     statemod.addunfinished(
-        'unshelve', fname=shelvedstate._filename,
+        'unshelve', fname=shelvedstate._filename, continueflag=True,
         cmdmsg=_('unshelve already in progress')
     )
-    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
@@ -1950,6 +1950,5 @@
     entry[1].append(('t', 'tool', '',
                      _("specify merge tool for rebase")))
     cmdutil.summaryhooks.add('rebase', summaryhook)
-    statemod.addunfinished('rebase', fname='rebasestate', stopflag=True)
-    statemod.afterresolvedstates.append(
-        ['rebasestate', _('hg rebase --continue')])
+    statemod.addunfinished('rebase', fname='rebasestate', stopflag=True,
+                            continueflag=True)
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -2313,6 +2313,6 @@
 
 def extsetup(ui):
     cmdutil.summaryhooks.add('histedit', summaryhook)
-    statemod.addunfinished('histedit', fname='histedit-state', 
allowcommit=True)
-    statemod.afterresolvedstates.append(
-        ['histedit-state', _('hg histedit --continue')])
+    statemod.addunfinished('histedit', fname='histedit-state', 
allowcommit=True,
+                            continueflag=True)
+



To: taapas1128, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to