changeset 4659:4d2f8c99f23a stable

templates: don't alias keywords directly Putting the same function twice in the registry results in duplicate doc strings and therefore confusing "hg help template" output.
author Joerg Sonnenberger <joerg@bec.de>
date Sat, 01 Jun 2019 02:30:14 +0200
parents 6292fe564b20
children b62ed7c69561
files hgext3rd/evolve/templatekw.py
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/templatekw.py	Sun May 05 22:48:41 2019 +0530
+++ b/hgext3rd/evolve/templatekw.py	Sat Jun 01 02:30:14 2019 +0200
@@ -39,14 +39,24 @@
         return templatekw.showlist('trouble', ctx.instabilities(), args,
                                    plural='troubles')
 
-templatekw.keywords["precursors"] = templatekw.showpredecessors
+_sp = templatekw.showpredecessors
+def showprecursors(context, mapping):
+    return _sp(context, mapping)
+showprecursors.__doc__ = _sp._origdoc
+_tk = templatekw.templatekeyword("precursors", requires=_sp._requires)
+_tk(showprecursors)
 
 def closestsuccessors(repo, nodeid):
     """ returns the closest visible successors sets instead.
     """
     return directsuccessorssets(repo, nodeid)
 
-templatekw.keywords["successors"] = templatekw.showsuccessorssets
+_ss = templatekw.showsuccessorssets
+def showsuccessors(context, mapping):
+    return _ss(context, mapping)
+showsuccessors.__doc__ = _ss._origdoc
+_tk = templatekw.templatekeyword("successors", requires=_ss._requires)
+_tk(showsuccessors)
 
 def _getusername(ui):
     """the default username in the config or None"""