diff mercurial/cmdutil.py @ 42540:0231032729c4

statecheck: added support for cmdutil.afterresolvedstates This removes `afterresolvedstates` from `cmdutil` and adds support for it in `_statecheck` class. A new flag `continueflag` is added to the class to check whether an operation supports `--continue` option or not. Tests remain unchanged. Differential Revision: https://phab.mercurial-scm.org/D6551
author Taapas Agrawal <taapas2897@gmail.com>
date Thu, 20 Jun 2019 11:40:08 +0530
parents 12243f15d53e
children f9da9d5f3f5a
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Sun Jun 09 02:12:58 2019 +0530
+++ b/mercurial/cmdutil.py	Thu Jun 20 11:40:08 2019 +0530
@@ -3296,11 +3296,6 @@
         if s._clearable and s.isunfinished(repo):
             util.unlink(repo.vfs.join(s._fname))
 
-afterresolvedstates = [
-    ('graftstate',
-     _('hg graft --continue')),
-    ]
-
 def howtocontinue(repo):
     '''Check for an unfinished operation and return the command to finish
     it.
@@ -3312,9 +3307,11 @@
     a boolean.
     '''
     contmsg = _("continue: %s")
-    for f, msg in afterresolvedstates:
-        if repo.vfs.exists(f):
-            return contmsg % msg, True
+    for state in statemod._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