mercurial/state.py
changeset 42533 0231032729c4
parent 42532 12243f15d53e
child 42534 faec09d89435
equal deleted inserted replaced
42532:12243f15d53e 42533:0231032729c4
    96        It also has the ability to register and determine the states of any new
    96        It also has the ability to register and determine the states of any new
    97        multistep operation or multistep command extension.
    97        multistep operation or multistep command extension.
    98     """
    98     """
    99 
    99 
   100     def __init__(self, opname, fname, clearable=False, allowcommit=False,
   100     def __init__(self, opname, fname, clearable=False, allowcommit=False,
   101                  reportonly=False, stopflag=False, cmdmsg="", cmdhint="",
   101                  reportonly=False, continueflag=False, stopflag=False ,
   102                  statushint=""):
   102                  cmdmsg="", cmdhint="", statushint=""):
   103         """opname is the name the command or operation
   103         """opname is the name the command or operation
   104         fname is the file name in which data should be stored in .hg directory.
   104         fname is the file name in which data should be stored in .hg directory.
   105         It is None for merge command.
   105         It is None for merge command.
   106         clearable boolean determines whether or not interrupted states can be
   106         clearable boolean determines whether or not interrupted states can be
   107         cleared by running `hg update -C .` which in turn deletes the
   107         cleared by running `hg update -C .` which in turn deletes the
   108         state file.
   108         state file.
   109         allowcommit boolean decides whether commit is allowed during interrupted
   109         allowcommit boolean decides whether commit is allowed during interrupted
   110         state or not.
   110         state or not.
   111         reportonly flag is used for operations like bisect where we just
   111         reportonly flag is used for operations like bisect where we just
   112         need to detect the operation using 'hg status --verbose'
   112         need to detect the operation using 'hg status --verbose'
       
   113         continueflag is a boolean determines whether or not a command supports
       
   114         `--continue` option or not.
   113         stopflag is a boolean that determines whether or not a command supports
   115         stopflag is a boolean that determines whether or not a command supports
   114         --stop flag
   116         --stop flag
   115         cmdmsg is used to pass a different status message in case standard
   117         cmdmsg is used to pass a different status message in case standard
   116         message of the format "abort: cmdname in progress" is not desired.
   118         message of the format "abort: cmdname in progress" is not desired.
   117         cmdhint is used to pass a different hint message in case standard
   119         cmdhint is used to pass a different hint message in case standard
   128         self._cmdhint = cmdhint
   130         self._cmdhint = cmdhint
   129         self._statushint = statushint
   131         self._statushint = statushint
   130         self._cmdmsg = cmdmsg
   132         self._cmdmsg = cmdmsg
   131         self._stopflag = stopflag
   133         self._stopflag = stopflag
   132         self._reportonly = reportonly
   134         self._reportonly = reportonly
       
   135         self._continueflag = continueflag
   133 
   136 
   134     def statusmsg(self):
   137     def statusmsg(self):
   135         """returns the hint message corresponding to the command for
   138         """returns the hint message corresponding to the command for
   136         hg status --verbose
   139         hg status --verbose
   137         """
   140         """
   158         """returns the status message corresponding to the command"""
   161         """returns the status message corresponding to the command"""
   159         if not self._cmdmsg:
   162         if not self._cmdmsg:
   160             return _('%s in progress') % (self._opname)
   163             return _('%s in progress') % (self._opname)
   161         return self._cmdmsg
   164         return self._cmdmsg
   162 
   165 
       
   166     def continuemsg(self):
       
   167         """ returns appropriate continue message corresponding to command"""
       
   168         return _('hg %s --continue') % (self._opname)
       
   169 
   163     def isunfinished(self, repo):
   170     def isunfinished(self, repo):
   164         """determines whether a multi-step operation is in progress
   171         """determines whether a multi-step operation is in progress
   165         or not
   172         or not
   166         """
   173         """
   167         if self._opname == 'merge':
   174         if self._opname == 'merge':
   181     else:
   188     else:
   182         _unfinishedstates.insert(0, statecheckobj)
   189         _unfinishedstates.insert(0, statecheckobj)
   183 
   190 
   184 addunfinished(
   191 addunfinished(
   185     'graft', fname='graftstate', clearable=True, stopflag=True,
   192     'graft', fname='graftstate', clearable=True, stopflag=True,
   186     cmdhint=_("use 'hg graft --continue' or 'hg graft --stop' to stop"),
   193     continueflag=True,
       
   194     cmdhint=_("use 'hg graft --continue' or 'hg graft --stop' to stop")
   187 )
   195 )
   188 addunfinished(
   196 addunfinished(
   189     'update', fname='updatestate', clearable=True,
   197     'update', fname='updatestate', clearable=True,
   190     cmdmsg=_('last update was interrupted'),
   198     cmdmsg=_('last update was interrupted'),
   191     cmdhint=_("use 'hg update' to get a consistent checkout"),
   199     cmdhint=_("use 'hg update' to get a consistent checkout"),