changeset 37324:c2f74b8f6b7f

templater: pass context to itermaps() for future extension Unlike show() and tovalue(), a base mapping isn't passed to itermaps() since it is the function to generate a partial mapping.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 18 Mar 2018 23:24:50 +0900
parents 8c31b434697f
children 41a5d815d2c1
files mercurial/templateutil.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templateutil.py	Sat Mar 17 21:21:50 2018 +0900
+++ b/mercurial/templateutil.py	Sun Mar 18 23:24:50 2018 +0900
@@ -38,7 +38,7 @@
     __metaclass__ = abc.ABCMeta
 
     @abc.abstractmethod
-    def itermaps(self):
+    def itermaps(self, context):
         """Yield each template mapping"""
 
     @abc.abstractmethod
@@ -88,7 +88,7 @@
             if i > 0:
                 yield ' '
             yield self.joinfmt(x)
-    def itermaps(self):
+    def itermaps(self, context):
         makemap = self._makemap
         for x in self._values:
             yield makemap(x)
@@ -139,7 +139,7 @@
     def tomap(self):
         return self._makemap(self._key)
 
-    def itermaps(self):
+    def itermaps(self, context):
         yield self.tomap()
 
     def show(self, context, mapping):
@@ -498,7 +498,7 @@
     darg, targ = data
     d = evalrawexp(context, mapping, darg)
     if isinstance(d, wrapped):
-        diter = d.itermaps()
+        diter = d.itermaps(context)
     else:
         try:
             diter = iter(d)