help: filter out deprecated options with untranslated descriptions
authorSimon Heimberg <simohe@besonet.ch>
Mon, 17 Feb 2014 07:39:53 +0100
changeset 20743 05267e6e94dd
parent 20742 3681de20b0a7
child 20744 9907b3f79ac2
help: filter out deprecated options with untranslated descriptions When using a different language than English, deprecated options were only removed from the output of `hg help anycmd` when "DEPRECATED" in the options description was translated.
mercurial/help.py
tests/test-help.t
--- a/mercurial/help.py	Wed Dec 04 20:38:27 2013 -0800
+++ b/mercurial/help.py	Mon Feb 17 07:39:53 2014 +0100
@@ -41,7 +41,7 @@
             shortopt, longopt, default, desc = option
             optlabel = _("VALUE") # default label
 
-        if _("DEPRECATED") in desc and not verbose:
+        if not verbose and ("DEPRECATED" in desc or _("DEPRECATED") in desc):
             continue
 
         so = ''
--- a/tests/test-help.t	Wed Dec 04 20:38:27 2013 -0800
+++ b/tests/test-help.t	Mon Feb 17 07:39:53 2014 +0100
@@ -649,6 +649,7 @@
   use "hg help" for the full list of commands or "hg -v" for details
   [255]
 
+
   $ cat > helpext.py <<EOF
   > import os
   > from mercurial import commands
@@ -657,6 +658,7 @@
   >     pass
   > 
   > cmdtable = {
+  >     "debugoptDEP": (nohelp, [('', 'dopt', None, 'option is DEPRECATED')],),
   >     "nohelp": (nohelp, [('', 'longdesc', 3, 'x'*90),
   >                         ('n', '', None, 'normal desc'),
   >                         ('', 'newline', '', 'line1\nline2'),
@@ -792,6 +794,33 @@
   
   use "hg -v help helpext" to show builtin aliases and global options
 
+
+test deprecated option is hidden in command help
+  $ hg help debugoptDEP
+  hg debugoptDEP
+  
+  (no help text available)
+  
+  options:
+  
+  use "hg -v help debugoptDEP" to show the global options
+
+test deprecated option is shown with -v
+  $ hg help -v debugoptDEP | grep dopt
+    --dopt option is DEPRECATED
+
+test deprecated option is hidden with translation with untranslated description
+(use many globy for not failing on changed transaction)
+  $ LANGUAGE=sv hg help debugoptDEP
+  hg debugoptDEP
+  
+  (*) (glob)
+  
+  flaggor:
+  
+  *"hg -v help debugoptDEP"* (glob)
+
+
 Test a help topic
 
   $ hg help revs