templatekw: keep compatibility with Mercurial 4.5
This is simple enough to do.
--- a/hgext3rd/evolve/templatekw.py Wed Jun 05 17:21:45 2019 +0200
+++ b/hgext3rd/evolve/templatekw.py Wed Jun 05 19:45:35 2019 +0200
@@ -55,11 +55,15 @@
plural='troubles')
_sp = templatekw.showpredecessors
-def showprecursors(context, mapping):
- return _sp(context, mapping)
-showprecursors.__doc__ = _sp._origdoc
-_tk = templatekw.templatekeyword("precursors", requires=_sp._requires)
-_tk(showprecursors)
+if util.safehasattr(_sp, '_requires'):
+ def showprecursors(context, mapping):
+ return _sp(context, mapping)
+ showprecursors.__doc__ = _sp._origdoc
+ _tk = templatekw.templatekeyword("precursors", requires=_sp._requires)
+ _tk(showprecursors)
+else:
+ templatekw.keywords["precursors"] = _sp
+
def closestsuccessors(repo, nodeid):
""" returns the closest visible successors sets instead.
@@ -67,11 +71,14 @@
return directsuccessorssets(repo, nodeid)
_ss = templatekw.showsuccessorssets
-def showsuccessors(context, mapping):
- return _ss(context, mapping)
-showsuccessors.__doc__ = _ss._origdoc
-_tk = templatekw.templatekeyword("successors", requires=_ss._requires)
-_tk(showsuccessors)
+if util.safehasattr(_ss, '_requires'):
+ def showsuccessors(context, mapping):
+ return _ss(context, mapping)
+ showsuccessors.__doc__ = _ss._origdoc
+ _tk = templatekw.templatekeyword("successors", requires=_ss._requires)
+ _tk(showsuccessors)
+else:
+ templatekw.keywords["successors"] = _ss
def _getusername(ui):
"""the default username in the config or None"""