D3669: cmdutil: have statefile names in STATES instead of functions
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Tue May 29 22:22:47 UTC 2018
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This will help us in unifying cmdutil.STATES and cmdutil.unfinishedstates as the
checking logic for STATES is moved to _getrepostate() and STATES now have just
filenames which is similar to unfinishedstates.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3669
AFFECTED FILES
mercurial/cmdutil.py
CHANGE DETAILS
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -627,25 +627,30 @@
STATES = (
# (state, predicate to detect states, helpful message function)
- ('histedit', fileexistspredicate('histedit-state'), _histeditmsg),
- ('bisect', fileexistspredicate('bisect.state'), _bisectmsg),
- ('graft', fileexistspredicate('graftstate'), _graftmsg),
- ('unshelve', fileexistspredicate('unshelverebasestate'), _unshelvemsg),
- ('rebase', fileexistspredicate('rebasestate'), _rebasemsg),
+ ('histedit', 'histedit-state', _histeditmsg),
+ ('bisect', 'bisect.state', _bisectmsg),
+ ('graft', 'graftstate', _graftmsg),
+ ('unshelve', 'unshelverebasestate', _unshelvemsg),
+ ('rebase', 'rebasestate', _rebasemsg),
# The merge state is part of a list that will be iterated over.
# They need to be last because some of the other unfinished states may also
# be in a merge or update state (eg. rebase, histedit, graft, etc).
# We want those to have priority.
- ('merge', _mergepredicate, _mergemsg),
+ ('merge', None, _mergemsg),
)
def _getrepostate(repo):
# experimental config: commands.status.skipstates
skip = set(repo.ui.configlist('commands', 'status.skipstates'))
- for state, statedetectionpredicate, msgfn in STATES:
+ for state, filename, msgfn in STATES:
if state in skip:
continue
- if statedetectionpredicate(repo):
+ detected = False
+ if state == 'merge':
+ detected = _mergepredicate(repo)
+ else:
+ detected = repo.vfs.exists(filename)
+ if detected:
return (state, msgfn)
def morestatus(repo, fm):
To: pulkit, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list