changeset 42534:faec09d89435

statecheck: shifted defaults to addunfinished() This shifts the definitions and defaults of `_statecheck()` class to `addunfinished()` registration method. Differential Revision: https://phab.mercurial-scm.org/D6583
author Taapas Agrawal <taapas2897@gmail.com>
date Fri, 28 Jun 2019 03:15:39 +0530
parents 0231032729c4
children df5f674050b7
files mercurial/state.py
diffstat 1 files changed, 34 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/state.py	Thu Jun 20 11:40:08 2019 +0530
+++ b/mercurial/state.py	Fri Jun 28 03:15:39 2019 +0530
@@ -97,42 +97,18 @@
        multistep operation or multistep command extension.
     """
 
-    def __init__(self, opname, fname, clearable=False, allowcommit=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.
-        clearable boolean determines whether or not interrupted states can be
-        cleared by running `hg update -C .` which in turn deletes the
-        state file.
-        allowcommit boolean decides whether commit is allowed during interrupted
-        state or not.
-        reportonly flag is used for operations like bisect where we just
-        need to detect the operation using 'hg status --verbose'
-        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
-        cmdmsg is used to pass a different status message in case standard
-        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
-        To abort: hg cmdname --abort" is not desired.
-        statushint 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
-        """
+    def __init__(self, opname, fname, clearable, allowcommit, reportonly,
+                 continueflag, stopflag, cmdmsg, cmdhint, statushint):
         self._opname = opname
         self._fname = fname
         self._clearable = clearable
         self._allowcommit = allowcommit
+        self._reportonly = reportonly
+        self._continueflag = continueflag
+        self._stopflag = stopflag
+        self._cmdmsg = cmdmsg
         self._cmdhint = cmdhint
         self._statushint = statushint
-        self._cmdmsg = cmdmsg
-        self._stopflag = stopflag
-        self._reportonly = reportonly
-        self._continueflag = continueflag
 
     def statusmsg(self):
         """returns the hint message corresponding to the command for
@@ -179,10 +155,36 @@
 # A list of statecheck objects for multistep operations like graft.
 _unfinishedstates = []
 
-def addunfinished(opname, **kwargs):
+def addunfinished(opname, fname, clearable=False, allowcommit=False,
+                  reportonly=False, continueflag=False, stopflag=False,
+                  cmdmsg="", cmdhint="", statushint=""):
     """this registers a new command or operation to unfinishedstates
+    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.
+    clearable boolean determines whether or not interrupted states can be
+    cleared by running `hg update -C .` which in turn deletes the
+    state file.
+    allowcommit boolean decides whether commit is allowed during interrupted
+    state or not.
+    reportonly flag is used for operations like bisect where we just
+    need to detect the operation using 'hg status --verbose'
+    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
+    cmdmsg is used to pass a different status message in case standard
+    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
+    To abort: hg cmdname --abort" is not desired.
+    statushint 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
     """
-    statecheckobj = _statecheck(opname, **kwargs)
+    statecheckobj = _statecheck(opname, fname, clearable, allowcommit,
+                                reportonly, continueflag, stopflag, cmdmsg,
+                                cmdhint, statushint)
     if opname == 'merge':
         _unfinishedstates.append(statecheckobj)
     else: