[PATCH] help: filter out deprecated options with untranslated descriptions
Simon Heimberg
simohe at besonet.ch
Mon Feb 17 15:09:03 CST 2014
# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1392619193 -3600
# Mon Feb 17 07:39:53 2014 +0100
# Node ID d4745c69913c70c0c7a42e1cf974faf9afb50985
# Parent 0e2877f8605dcaf4fdf2ab7e0046f1f6f80161dd
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.
diff -r 0e2877f8605d -r d4745c69913c mercurial/help.py
--- a/mercurial/help.py Sat Feb 15 22:09:32 2014 -0600
+++ b/mercurial/help.py Mon Feb 17 07:39:53 2014 +0100
@@ -38,7 +38,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 = ''
diff -r 0e2877f8605d -r d4745c69913c tests/test-help.t
--- a/tests/test-help.t Sat Feb 15 22:09:32 2014 -0600
+++ b/tests/test-help.t Mon Feb 17 07:39:53 2014 +0100
@@ -569,6 +569,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
@@ -578,6 +579,7 @@
>
> cmdtable = {
> "nohelp": (nohelp, [], "hg nohelp"),
+ > "debugoptDEP": (nohelp, [('', 'dopt', None, 'option is DEPRECATED')],),
> }
>
> commands.norepo += ' nohelp'
@@ -702,6 +704,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
More information about the Mercurial-devel
mailing list