Mercurial > evolve
changeset 4662:87d60fed455a stable
templatekw: keep compatibility with Mercurial 4.5
This is simple enough to do.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 05 Jun 2019 19:45:35 +0200 |
parents | df41605bd26c |
children | a1a8adcd5155 d0d8c0e2f3fc |
files | hgext3rd/evolve/templatekw.py |
diffstat | 1 files changed, 17 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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"""