mercurial/templateutil.py
changeset 37323 8c31b434697f
parent 37279 26f6fc179e62
child 37324 c2f74b8f6b7f
equal deleted inserted replaced
37322:a67fd1fe5109 37323:8c31b434697f
    34     Use unwrapvalue(), unwrapastype(), or unwraphybrid() to obtain the inner
    34     Use unwrapvalue(), unwrapastype(), or unwraphybrid() to obtain the inner
    35     object.
    35     object.
    36     """
    36     """
    37 
    37 
    38     __metaclass__ = abc.ABCMeta
    38     __metaclass__ = abc.ABCMeta
       
    39 
       
    40     @abc.abstractmethod
       
    41     def itermaps(self):
       
    42         """Yield each template mapping"""
    39 
    43 
    40     @abc.abstractmethod
    44     @abc.abstractmethod
    41     def show(self, context, mapping):
    45     def show(self, context, mapping):
    42         """Return a bytes or (possibly nested) generator of bytes representing
    46         """Return a bytes or (possibly nested) generator of bytes representing
    43         the underlying object
    47         the underlying object
   491             % (fn, sym))
   495             % (fn, sym))
   492 
   496 
   493 def runmap(context, mapping, data):
   497 def runmap(context, mapping, data):
   494     darg, targ = data
   498     darg, targ = data
   495     d = evalrawexp(context, mapping, darg)
   499     d = evalrawexp(context, mapping, darg)
   496     if util.safehasattr(d, 'itermaps'):
   500     if isinstance(d, wrapped):
   497         diter = d.itermaps()
   501         diter = d.itermaps()
   498     else:
   502     else:
   499         try:
   503         try:
   500             diter = iter(d)
   504             diter = iter(d)
   501         except TypeError:
   505         except TypeError: