mercurial/templateutil.py
changeset 38283 0e0d03d09ecd
parent 38272 354fad8697fd
child 38284 e72697893c93
equal deleted inserted replaced
38282:1a05e205832a 38283:0e0d03d09ecd
   213         if val is None:
   213         if val is None:
   214             return
   214             return
   215         if util.safehasattr(val, '_makemap'):
   215         if util.safehasattr(val, '_makemap'):
   216             # a nested hybrid list/dict, which has its own way of map operation
   216             # a nested hybrid list/dict, which has its own way of map operation
   217             return val
   217             return val
   218         return mappable(None, key, val, self._makemap)
   218         return hybriditem(None, key, val, self._makemap)
   219 
   219 
   220     def itermaps(self, context):
   220     def itermaps(self, context):
   221         makemap = self._makemap
   221         makemap = self._makemap
   222         for x in self._values:
   222         for x in self._values:
   223             yield makemap(x)
   223             yield makemap(x)
   241         if util.safehasattr(xs, 'get'):
   241         if util.safehasattr(xs, 'get'):
   242             return {k: unwrapvalue(context, mapping, v)
   242             return {k: unwrapvalue(context, mapping, v)
   243                     for k, v in xs.iteritems()}
   243                     for k, v in xs.iteritems()}
   244         return [unwrapvalue(context, mapping, x) for x in xs]
   244         return [unwrapvalue(context, mapping, x) for x in xs]
   245 
   245 
   246 class mappable(wrapped):
   246 class hybriditem(wrapped):
   247     """Wrapper for non-list/dict object to support map operation
   247     """Wrapper for non-list/dict object to support map operation
   248 
   248 
   249     This class allows us to handle both:
   249     This class allows us to handle both:
   250     - "{manifest}"
   250     - "{manifest}"
   251     - "{manifest % '{rev}:{node}'}"
   251     - "{manifest % '{rev}:{node}'}"