[PATCH] help: filter out deprecated options with untranslated descriptions

Mads Kiilerich mads at kiilerich.com
Sat Feb 22 12:41:12 CST 2014


On 02/17/2014 10:09 PM, Simon Heimberg wrote:
> # 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):

It seems a bit fragile to put semantics in having totally consistent 
translation of DEPRECATED. (And even more so to base the test on having 
it translated in the Swedish translation.)

BUT we do already check for the translated string elsewhere in help.py, 
so this is just making it consistent and not making it worse.

Another observation is that it is inconsistent whether the magic string 
is "DEPRECATED" or "(DEPRECATED)".

It seems like a better solution would be to only check for the magic 
word in the untranslated string - and either pass that or a flag around 
where it is needed. Alternatively, have a flag when defining an option 
and then add add the DEPRECATED string when relevant when the option 
description is shown to the user.

/Mads



More information about the Mercurial-devel mailing list