mercurial/namespaces.py
changeset 23610 9266d1dd6a6e
parent 23608 807ee1a02bb0
child 23715 eee55c09010a
equal deleted inserted replaced
23609:40fcf6c05217 23610:9266d1dd6a6e
     1 from i18n import _
     1 from i18n import _
     2 from mercurial import util
     2 from mercurial import util
       
     3 import templatekw
     3 
     4 
     4 def tolist(val):
     5 def tolist(val):
     5     """
     6     """
     6     a convenience method to return an empty list instead of None
     7     a convenience method to return an empty list instead of None
     7     """
     8     """
    72         if order is not None:
    73         if order is not None:
    73             self._names.insert(order, namespace, val)
    74             self._names.insert(order, namespace, val)
    74         else:
    75         else:
    75             self._names[namespace] = val
    76             self._names[namespace] = val
    76 
    77 
       
    78         # we only generate a template keyword if one does not already exist
       
    79         if namespace not in templatekw.keywords:
       
    80             def generatekw(**args):
       
    81                 return templatekw.shownames(namespace, **args)
       
    82 
       
    83             templatekw.keywords[namespace] = generatekw
       
    84 
    77     def singlenode(self, repo, name):
    85     def singlenode(self, repo, name):
    78         """
    86         """
    79         Return the 'best' node for the given name. Best means the first node
    87         Return the 'best' node for the given name. Best means the first node
    80         in the first nonempty list returned by a name-to-nodes mapping function
    88         in the first nonempty list returned by a name-to-nodes mapping function
    81         in the defined precedence order.
    89         in the defined precedence order.