comparison mercurial/namespaces.py @ 36622:900e5ee44307

templatekw: switch namespace template keywords to new API
author Yuya Nishihara <yuya@tcha.org>
date Sun, 25 Feb 2018 18:52:51 +0900
parents b0054f3c055a
children aa97e06a1912
comparison
equal deleted inserted replaced
36621:b0054f3c055a 36622:900e5ee44307
87 self._names[namespace.name] = namespace 87 self._names[namespace.name] = namespace
88 88
89 # we only generate a template keyword if one does not already exist 89 # we only generate a template keyword if one does not already exist
90 if namespace.name not in templatekw.keywords: 90 if namespace.name not in templatekw.keywords:
91 templatekeyword = registrar.templatekeyword(templatekw.keywords) 91 templatekeyword = registrar.templatekeyword(templatekw.keywords)
92 @templatekeyword(namespace.name) 92 @templatekeyword(namespace.name, requires={'repo', 'ctx', 'templ'})
93 def generatekw(**args): 93 def generatekw(context, mapping):
94 return templatekw.shownames(namespace.name, **args) 94 return templatekw.shownames(context, mapping, namespace.name)
95 95
96 def singlenode(self, repo, name): 96 def singlenode(self, repo, name):
97 """ 97 """
98 Return the 'best' node for the given name. Best means the first node 98 Return the 'best' node for the given name. Best means the first node
99 in the first nonempty list returned by a name-to-nodes mapping function 99 in the first nonempty list returned by a name-to-nodes mapping function