mercurial/namespaces.py
changeset 36592 b0054f3c055a
parent 35212 c7b45db8f317
child 36593 900e5ee44307
equal deleted inserted replaced
36591:121a20e5da56 36592:b0054f3c055a
     1 from __future__ import absolute_import
     1 from __future__ import absolute_import
     2 
     2 
     3 from .i18n import _
     3 from .i18n import _
     4 from . import (
     4 from . import (
       
     5     registrar,
     5     templatekw,
     6     templatekw,
     6     util,
     7     util,
     7 )
     8 )
     8 
     9 
     9 def tolist(val):
    10 def tolist(val):
    85         else:
    86         else:
    86             self._names[namespace.name] = namespace
    87             self._names[namespace.name] = namespace
    87 
    88 
    88         # 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
    89         if namespace.name not in templatekw.keywords:
    90         if namespace.name not in templatekw.keywords:
       
    91             templatekeyword = registrar.templatekeyword(templatekw.keywords)
       
    92             @templatekeyword(namespace.name)
    90             def generatekw(**args):
    93             def generatekw(**args):
    91                 return templatekw.shownames(namespace.name, **args)
    94                 return templatekw.shownames(namespace.name, **args)
    92 
       
    93             templatekw.keywords[namespace.name] = generatekw
       
    94 
    95 
    95     def singlenode(self, repo, name):
    96     def singlenode(self, repo, name):
    96         """
    97         """
    97         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
    98         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