comparison hgext3rd/evolve/exthelper.py @ 2926:1abafae41fe2

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.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 07 Aug 2017 23:22:41 +0900
parents 9efedcedd9dd
children
comparison
equal deleted inserted replaced
2925:9efedcedd9dd 2926:1abafae41fe2
97 revsetpredicate = registrar.revsetpredicate() 97 revsetpredicate = registrar.revsetpredicate()
98 for name, symbol in self._revsetsymbols: 98 for name, symbol in self._revsetsymbols:
99 revsetpredicate(name)(symbol) 99 revsetpredicate(name)(symbol)
100 revset.loadpredicate(ui, 'evolve', revsetpredicate) 100 revset.loadpredicate(ui, 'evolve', revsetpredicate)
101 101
102 templatekeyword = registrar.templatekeyword()
102 for name, kw in self._templatekws: 103 for name, kw in self._templatekws:
103 templatekw.keywords[name] = kw 104 templatekeyword(name)(kw)
105 templatekw.loadkeyword(ui, 'evolve', templatekeyword)
106
104 for ext, command, wrapper, opts in self._extcommandwrappers: 107 for ext, command, wrapper, opts in self._extcommandwrappers:
105 if ext not in knownexts: 108 if ext not in knownexts:
106 try: 109 try:
107 e = extensions.find(ext) 110 e = extensions.find(ext)
108 except KeyError: 111 except KeyError: