templater: inline wraphybridvalue()
All wraphybridvalue() calls are now handled in the hybrid class.
--- a/mercurial/templateutil.py Mon Mar 19 00:16:12 2018 +0900
+++ b/mercurial/templateutil.py Wed Mar 21 12:06:18 2018 +0900
@@ -193,7 +193,10 @@
def _wrapvalue(self, key, val):
if val is None:
return
- return wraphybridvalue(self, key, val)
+ if util.safehasattr(val, '_makemap'):
+ # a nested hybrid list/dict, which has its own way of map operation
+ return val
+ return mappable(None, key, val, self._makemap)
def itermaps(self, context):
makemap = self._makemap
@@ -422,20 +425,6 @@
return thing
return thing.show(context, mapping)
-def wraphybridvalue(container, key, value):
- """Wrap an element of hybrid container to be mappable
-
- The key is passed to the makemap function of the given container, which
- should be an item generated by iter(container).
- """
- makemap = getattr(container, '_makemap', None)
- if makemap is None:
- return value
- if util.safehasattr(value, '_makemap'):
- # a nested hybrid list/dict, which has its own way of map operation
- return value
- return mappable(None, key, value, makemap)
-
def compatdict(context, mapping, name, data, key='key', value='value',
fmt=None, plural=None, separator=' '):
"""Wrap data like hybriddict(), but also supports old-style list template