[PATCH] help.merge-tools: do not double document merge tools

Yuya Nishihara yuya at tcha.org
Tue Feb 10 08:45:43 CST 2015


On Tue, 10 Feb 2015 00:13:26 -0800, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1423552059 28800
> #      Mon Feb 09 23:07:39 2015 -0800
> # Node ID 4546a7e61c56a89e20832fd9dba35f5a3a2bb019
> # Parent  adea44d4aa1a829527a1b345716ee22dbdf5cfaf
> help.merge-tools: do not double document merge tools
> 
> Merge tools were being double documented in help system output due
> to functions being defined under multiple names in the merge tools
> dictionary.
> 
> Establish a new dictionary for just the tools to document and
> use it from the help system so we don't get double output.
> 
> Double documentation likely plagues other auto-documented items
> as well. It might be a good idea to eventually compare function
> instances to filter out duplicate entries from dictionaries
> passed to ``makeitemsdoc``. However, without an easy way to break
> ties, this may result in some functions being advertised over
> their modern equivalents. This would be a noble patch series.
> But it isn't one this author is willing to tackle at this time.
> 
> diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
> --- a/mercurial/filemerge.py
> +++ b/mercurial/filemerge.py
> @@ -20,16 +20,19 @@ def _toolbool(ui, tool, part, default=Fa
>  def _toollist(ui, tool, part, default=[]):
>      return ui.configlist("merge-tools", tool + "." + part, default)
>  
>  internals = {}
> +# Merge tools to document.
> +internalsdoc = {}
>  
>  def internaltool(name, trymerge, onfailure=None):
>      '''return a decorator for populating internal merge tool table'''
>      def decorator(func):
>          fullname = ':' + name
>          func.__doc__ = "``%s``\n" % fullname + func.__doc__.strip()
>          internals[fullname] = func
>          internals['internal:' + name] = func
> +        internalsdoc[fullname] = func
>          func.trymerge = trymerge
>          func.onfailure = onfailure
>          return func
>      return decorator

i18nfunctions are also doubled though it seems duplicates are removed by
xgettext.


More information about the Mercurial-devel mailing list