[PATCH] help.merge-tools: do not double document merge tools
Gregory Szorc
gregory.szorc at gmail.com
Tue Feb 10 08:13:26 UTC 2015
# 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
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -203,9 +203,10 @@ def addtopicsymbols(topic, marker, symbo
return makeitemsdoc(topic, doc, marker, symbols, dedent=dedent)
addtopichook(topic, add)
addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
-addtopicsymbols('merge-tools', '.. internaltoolsmarker', filemerge.internals)
+addtopicsymbols('merge-tools', '.. internaltoolsmarker',
+ filemerge.internalsdoc)
addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols)
addtopicsymbols('templates', '.. keywordsmarker', templatekw.dockeywords)
addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
More information about the Mercurial-devel
mailing list