Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 42539:12243f15d53e
statecheck: added support for STATES
This removes `STATES` from `state.py` and adds support to
`statecheck` class to handle its features.
`getrepostate()` function is modified accordingly.
This adds a method 'cmdutil.addunfinished()' for appending to
the unfinishedstate list so as to keep 'merge' and 'bisect' at the last.
This also makes two separate message formats for `checkunfinished()` and
`getrepostate()` as there were previously present.
Results of test changed are shown.
Differential Revision: https://phab.mercurial-scm.org/D6503
author | Taapas Agrawal <taapas2897@gmail.com> |
---|---|
date | Sun, 09 Jun 2019 02:12:58 +0530 |
parents | 5bddd2244814 |
children | 0231032729c4 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sun Jun 09 01:13:13 2019 +0530 +++ b/mercurial/cmdutil.py Sun Jun 09 02:12:58 2019 +0530 @@ -623,15 +623,14 @@ statetuple = statemod.getrepostate(repo) label = 'status.morestatus' if statetuple: - state, statedetectionpredicate, helpfulmsg = statetuple + state, helpfulmsg = statetuple statemsg = _('The repository is in an unfinished *%s* state.') % state fm.plain('%s\n' % _commentlines(statemsg), label=label) conmsg = _conflictsmsg(repo) if conmsg: fm.plain('%s\n' % conmsg, label=label) if helpfulmsg: - helpmsg = helpfulmsg() - fm.plain('%s\n' % helpmsg, label=label) + fm.plain('%s\n' % _commentlines(helpfulmsg), label=label) def findpossible(cmd, table, strict=False): """ @@ -3260,7 +3259,7 @@ summaryremotehooks = util.hooks() -def checkunfinished(repo, commit=False): +def checkunfinished(repo, commit=False, skipmerge=False): '''Look for an unfinished multistep operation, like graft, and abort if found. It's probably good to check this right before bailifchanged(). @@ -3268,13 +3267,15 @@ # Check for non-clearable states first, so things like rebase will take # precedence over update. for state in statemod._unfinishedstates: - if state._clearable or (commit and state._allowcommit): + if (state._clearable or (commit and state._allowcommit) or + state._reportonly): continue if state.isunfinished(repo): raise error.Abort(state.msg(), hint=state.hint()) for s in statemod._unfinishedstates: - if not s._clearable or (commit and s._allowcommit): + if (not s._clearable or (commit and s._allowcommit) or + (s._opname == 'merge' and skipmerge) or s._reportonly): continue if s.isunfinished(repo): raise error.Abort(s.msg(), hint=s.hint()) @@ -3284,10 +3285,14 @@ that are clearable. ''' for state in statemod._unfinishedstates: + if state._reportonly: + continue if not state._clearable and state.isunfinished(repo): raise error.Abort(state.msg(), hint=state.hint()) for s in statemod._unfinishedstates: + if s._opname == 'merge' or state._reportonly: + continue if s._clearable and s.isunfinished(repo): util.unlink(repo.vfs.join(s._fname))