changeset 27323:0fe93498ef07

help: refactor filtercmd
author timeless <timeless@mozdev.org>
date Wed, 09 Dec 2015 19:09:06 +0000
parents 84e85f461b79
children 5456374561a7
files mercurial/help.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/help.py	Mon Nov 30 19:28:26 2015 +0000
+++ b/mercurial/help.py	Wed Dec 09 19:09:06 2015 +0000
@@ -84,6 +84,13 @@
     if notomitted:
         rst.append('\n\n.. container:: notomitted\n\n    %s\n\n' % notomitted)
 
+def filtercmd(ui, cmd, kw, doc):
+    if not ui.debugflag and cmd.startswith("debug") and kw != "debug":
+        return True
+    if not ui.verbose and doc and any(w in doc for w in _exclkeywords):
+        return True
+    return False
+
 def topicmatch(ui, kw):
     """Return help topics matching kw.
 
@@ -340,10 +347,8 @@
             if name == "shortlist" and not f.startswith("^"):
                 continue
             f = f.lstrip("^")
-            if not ui.debugflag and f.startswith("debug") and name != "debug":
-                continue
             doc = e[0].__doc__
-            if not ui.verbose and doc and any(w in doc for w in _exclkeywords):
+            if filtercmd(ui, f, name, doc):
                 continue
             doc = gettext(doc)
             if not doc: