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

mail settings
Submitter Augie Fackler
Date May 3, 2017, 2:04 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/20404/
State Accepted
Headers show


Augie Fackler - May 3, 2017, 2:04 p.m.
# HG changeset patch
# User Augie Fackler <>
# 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.
Jun Wu - May 3, 2017, 5:37 p.m.
Pushed. Thanks!

Excerpts from Augie Fackler's message of 2017-05-03 10:04:41 -0400:
> [...]
>  def getrepostate(repo):

Added "# experimental config: morestatus.skipstates" here to make
"test-check-config-hg.t" happy.

> +    skip = set(repo.ui.configlist('morestatus', 'skipstates', []))
> [...]


diff --git a/hgext3rd/ b/hgext3rd/
--- a/hgext3rd/
+++ b/hgext3rd/
@@ -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