[PATCH morestatus-ext] morestatus: add config knob to allow some states to be skipped

Augie Fackler raf at durin42.com
Wed May 3 14:04:41 UTC 2017


# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1493820234 14400
#      Wed May 03 10:03:54 2017 -0400
# Node ID 1650550d3b4fdb4ae0038df48514f4c941fe7e1c
# Parent  a114a78ed716b4451c8c202c892a63653f756a95
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.

diff --git a/hgext3rd/morestatus.py b/hgext3rd/morestatus.py
--- a/hgext3rd/morestatus.py
+++ b/hgext3rd/morestatus.py
@@ -149,6 +149,9 @@ def statuscmd(orig, ui, repo, *pats, **o
     return ret
 
 def getrepostate(repo):
+    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)
diff --git a/tests/test-morestatus.t b/tests/test-morestatus.t
--- a/tests/test-morestatus.t
+++ b/tests/test-morestatus.t
@@ -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


More information about the Mercurial-devel mailing list