morestatus: add config knob to allow some states to be skipped

The main rationale for this change is that I've got years of use
patterns on bisect where I *start* bisect by running 'hg bisect
--reset', not *finish* with that command, so `hg status` with
morestatus enabled is spewing annoyances in nearly every repository
I've ever used. It wasn't any harder to allow people to ignore
anything they want, but (at least for now) bisect is the only state
that seems "special" in that it doesn't have a definite "end" that
Mercurial can detect and automatically clean up. I'd also be fine with
adding something like morestatus.ignorebisect if we want to avoid a
potential footgun where a user could ignore rebase state.
This commit is contained in:
Augie Fackler 2017-05-03 13:34:36 -04:00
parent 0723212833
commit f198dbbc1e
2 changed files with 7 additions and 0 deletions

View File

@ -149,6 +149,10 @@ def statuscmd(orig, ui, repo, *pats, **opts):
return ret
def getrepostate(repo):
# experimental config: morestatus.skipstates
skip = set(repo.ui.configlist('morestatus', 'skipstates', []))
for state, statedetectionpredicate, msgfn in STATES:
if state in skip:
continue
if statedetectionpredicate(repo):
return (state, statedetectionpredicate, msgfn)

View File

@ -54,6 +54,9 @@ Test bisect state
# To mark the changeset bad: hg bisect --bad
# To abort: hg bisect --reset
Verify that suppressing a morestatus state warning works with the config knob:
$ hg status --config morestatus.skipstates=bisect
Test hg status is normal after bisect reset
$ hg bisect --reset
$ hg status