help.merge-tools: do not double document merge tools
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 09 Feb 2015 23:07:39 -0800
changeset 24099 be83fd9d46d5
parent 24098 067540702f64
child 24100 7f23e67e9c38
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.
mercurial/filemerge.py
mercurial/help.py
--- a/mercurial/filemerge.py	Mon Feb 09 14:59:04 2015 -0800
+++ b/mercurial/filemerge.py	Mon Feb 09 23:07:39 2015 -0800
@@ -21,6 +21,8 @@
     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'''
@@ -29,6 +31,7 @@
         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
--- a/mercurial/help.py	Mon Feb 09 14:59:04 2015 -0800
+++ b/mercurial/help.py	Mon Feb 09 23:07:39 2015 -0800
@@ -204,7 +204,8 @@
     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)