# HG changeset patch # User Pierre-Yves David # Date 1520201273 18000 # Node ID d5a824a5853f57b9307e9d490091e5e16569a8a4 # Parent 498f782ccb4b614b82becd2aa4a256747fb2936f exthelper: add support for "requires" argument for template keyword This will help use to support the new template API. diff -r 498f782ccb4b -r d5a824a5853f hgext3rd/evolve/exthelper.py --- a/hgext3rd/evolve/exthelper.py Sat Mar 03 23:17:26 2018 -0500 +++ b/hgext3rd/evolve/exthelper.py Sun Mar 04 17:07:53 2018 -0500 @@ -128,8 +128,11 @@ revset.loadpredicate(ui, 'evolve', revsetpredicate) templatekeyword = registrar.templatekeyword() - for name, kw in self._templatekws: - templatekeyword(name)(kw) + for name, kw, requires in self._templatekws: + if requires is not None: + templatekeyword(name, requires=requires)(kw) + else: + templatekeyword(name)(kw) templatekw.loadkeyword(ui, 'evolve', templatekeyword) for ext, command, wrapper, opts in self._extcommandwrappers: @@ -215,7 +218,7 @@ return symbol return dec - def templatekw(self, keywordname): + def templatekw(self, keywordname, requires=None): """Decorated function is a template keyword The name of the keyword must be given as the decorator argument. @@ -228,7 +231,7 @@ return 'babar' """ def dec(keyword): - self._templatekws.append((keywordname, keyword)) + self._templatekws.append((keywordname, keyword, requires)) return keyword return dec