comparison mercurial/cmdutil.py @ 42533: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
comparison
equal deleted inserted replaced
42532:12243f15d53e 42533:0231032729c4
3294 if s._opname == 'merge' or state._reportonly: 3294 if s._opname == 'merge' or state._reportonly:
3295 continue 3295 continue
3296 if s._clearable and s.isunfinished(repo): 3296 if s._clearable and s.isunfinished(repo):
3297 util.unlink(repo.vfs.join(s._fname)) 3297 util.unlink(repo.vfs.join(s._fname))
3298 3298
3299 afterresolvedstates = [
3300 ('graftstate',
3301 _('hg graft --continue')),
3302 ]
3303
3304 def howtocontinue(repo): 3299 def howtocontinue(repo):
3305 '''Check for an unfinished operation and return the command to finish 3300 '''Check for an unfinished operation and return the command to finish
3306 it. 3301 it.
3307 3302
3308 afterresolvedstates tuples define a .hg/{file} and the corresponding 3303 afterresolvedstates tuples define a .hg/{file} and the corresponding
3310 3305
3311 Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is 3306 Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is
3312 a boolean. 3307 a boolean.
3313 ''' 3308 '''
3314 contmsg = _("continue: %s") 3309 contmsg = _("continue: %s")
3315 for f, msg in afterresolvedstates: 3310 for state in statemod._unfinishedstates:
3316 if repo.vfs.exists(f): 3311 if not state._continueflag:
3317 return contmsg % msg, True 3312 continue
3313 if state.isunfinished(repo):
3314 return contmsg % state.continuemsg(), True
3318 if repo[None].dirty(missing=True, merge=False, branch=False): 3315 if repo[None].dirty(missing=True, merge=False, branch=False):
3319 return contmsg % _("hg commit"), False 3316 return contmsg % _("hg commit"), False
3320 return None, None 3317 return None, None
3321 3318
3322 def checkafterresolved(repo): 3319 def checkafterresolved(repo):