# HG changeset patch # User Yuya Nishihara # Date 1521383090 -32400 # Node ID c2f74b8f6b7fb0504194f5456e1286d6ee260435 # Parent 8c31b434697f7e576d3b9a11d6facb6af1d12d92 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. diff -r 8c31b434697f -r c2f74b8f6b7f mercurial/templateutil.py --- 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)