# HG changeset patch # User FUJIWARA Katsunori # Date 1502115761 -32400 # Node ID 1abafae41fe26e5b34691c84b9e2064f80e03583 # Parent 9efedcedd9dd16039b9c8e4e6de141d59851b0d2 evolve: use registrar.templatekeyword to register template keyword functions Now, using registrar.templatekeyword of Mercurial directly in evolve extension should be safe enough. because it has been available since Mercurial 3.8, and minimum Mercurial version for evolve extension is 3.8, too. BTW, this also fixes an issue of "hg help templates" output that template keywords "precursors" and "successors" are not displayed as same as others, because they do not have ":KEYWORD:" prefix in their docstring. diff -r 9efedcedd9dd -r 1abafae41fe2 hgext3rd/evolve/exthelper.py --- a/hgext3rd/evolve/exthelper.py Sun Sep 10 20:06:52 2017 +0900 +++ b/hgext3rd/evolve/exthelper.py Mon Aug 07 23:22:41 2017 +0900 @@ -99,8 +99,11 @@ revsetpredicate(name)(symbol) revset.loadpredicate(ui, 'evolve', revsetpredicate) + templatekeyword = registrar.templatekeyword() for name, kw in self._templatekws: - templatekw.keywords[name] = kw + templatekeyword(name)(kw) + templatekw.loadkeyword(ui, 'evolve', templatekeyword) + for ext, command, wrapper, opts in self._extcommandwrappers: if ext not in knownexts: try: diff -r 9efedcedd9dd -r 1abafae41fe2 hgext3rd/evolve/templatekw.py --- a/hgext3rd/evolve/templatekw.py Sun Sep 10 20:06:52 2017 +0900 +++ b/hgext3rd/evolve/templatekw.py Mon Aug 07 23:22:41 2017 +0900 @@ -28,7 +28,7 @@ @eh.templatekw('obsolete') def obsoletekw(repo, ctx, templ, **args): - """:obsolete: String. Whether the changeset is ``obsolete``. + """String. Whether the changeset is ``obsolete``. """ if ctx.obsolete(): return 'obsolete' @@ -36,7 +36,7 @@ @eh.templatekw('troubles') def showtroubles(**args): - """:troubles: List of strings. Evolution troubles affecting the changeset + """List of strings. Evolution troubles affecting the changeset (zero or more of "unstable", "divergent" or "bumped").""" ctx = args['ctx'] try: