[PATCH 2 of 3] help: include parens in DEPRECATED/EXPERIMENTAL keywords

Yuya Nishihara yuya at tcha.org
Sat Sep 26 00:31:08 CDT 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1443235119 -32400
#      Sat Sep 26 11:38:39 2015 +0900
# Node ID 137a17bb4d921345a0221b1432381358f4898abf
# Parent  14746f6af9b5458f1ba034442b2fc22e80a6f866
help: include parens in DEPRECATED/EXPERIMENTAL keywords

In some languages that have no caps, "DEPRECATED" and "deprecated" can be
translated to the same byte sequence. So it is too wild to exclude messages
by _("DEPRECATED").

diff --git a/hgext/convert/__init__.py b/hgext/convert/__init__.py
--- a/hgext/convert/__init__.py
+++ b/hgext/convert/__init__.py
@@ -25,7 +25,7 @@ testedwith = 'internal'
 
 @command('convert',
     [('', 'authors', '',
-      _('username mapping filename (DEPRECATED, use --authormap instead)'),
+      _('username mapping filename (DEPRECATED) (use --authormap instead)'),
       _('FILE')),
     ('s', 'source-type', '', _('source repository type'), _('TYPE')),
     ('d', 'dest-type', '', _('destination repository type'), _('TYPE')),
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -15,10 +15,12 @@ import cmdutil
 import hgweb.webcommands as webcommands
 
 _exclkeywords = [
-    "DEPRECATED",
-    "EXPERIMENTAL",
-    _("DEPRECATED"),
-    _("EXPERIMENTAL"),
+    "(DEPRECATED)",
+    "(EXPERIMENTAL)",
+    # i18n: "(DEPRECATED)" is a keyword, must be translated consistently
+    _("(DEPRECATED)"),
+    # i18n: "(EXPERIMENTAL)" is a keyword, must be translated consistently
+    _("(EXPERIMENTAL)"),
     ]
 
 def listexts(header, exts, indent=1, showdeprecated=False):
@@ -339,7 +341,7 @@ def help_(ui, name, unknowncmd=False, fu
             if not ui.debugflag and f.startswith("debug") and name != "debug":
                 continue
             doc = e[0].__doc__
-            if doc and 'DEPRECATED' in doc and not ui.verbose:
+            if doc and '(DEPRECATED)' in doc and not ui.verbose:
                 continue
             doc = gettext(doc)
             if not doc:
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -646,8 +646,8 @@ this is a section and erroring out weird
   >     ('', 'newline', '', 'line1\nline2')],
   >     'hg nohelp',
   >     norepo=True)
-  > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')])
-  > @command('debugoptEXP', [('', 'eopt', None, 'option is EXPERIMENTAL')])
+  > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
+  > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
   > def nohelp(ui, *args, **kwargs):
   >     pass
   > 
@@ -868,9 +868,9 @@ test deprecated and experimental options
 
 test deprecated and experimental options is shown with -v
   $ hg help -v debugoptDEP | grep dopt
-    --dopt option is DEPRECATED
+    --dopt option is (DEPRECATED)
   $ hg help -v debugoptEXP | grep eopt
-    --eopt option is EXPERIMENTAL
+    --eopt option is (EXPERIMENTAL)
 
 #if gettext
 test deprecated option is hidden with translation with untranslated description


More information about the Mercurial-devel mailing list