Patchwork [1,of,3] help: define list of keywords that should be excluded from non-verbose output

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 26, 2015, 5:31 a.m.
Message ID <14746f6af9b5458f1ba0.1443245467@mimosa>
Download mbox | patch
Permalink /patch/10654/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 26, 2015, 5:31 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1443234338 -32400
#      Sat Sep 26 11:25:38 2015 +0900
# Node ID 14746f6af9b5458f1ba034442b2fc22e80a6f866
# Parent  7a6f477ee7ffac05e01db296a2a71cc56bece8ba
help: define list of keywords that should be excluded from non-verbose output

This list will be reused by the other deprecated/experimental handling.

Patch

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -14,6 +14,13 @@  import encoding, util, minirst
 import cmdutil
 import hgweb.webcommands as webcommands
 
+_exclkeywords = [
+    "DEPRECATED",
+    "EXPERIMENTAL",
+    _("DEPRECATED"),
+    _("EXPERIMENTAL"),
+    ]
+
 def listexts(header, exts, indent=1, showdeprecated=False):
     '''return a text listing of the given extensions'''
     rst = []
@@ -43,9 +50,7 @@  def optrst(header, options, verbose):
             shortopt, longopt, default, desc = option
             optlabel = _("VALUE") # default label
 
-        if not verbose and ("DEPRECATED" in desc or _("DEPRECATED") in desc or
-                            "EXPERIMENTAL" in desc or
-                            _("EXPERIMENTAL") in desc):
+        if not verbose and any(w in desc for w in _exclkeywords):
             continue
 
         so = ''