--- a/mercurial/templateutil.py Thu Mar 15 21:09:37 2018 +0900
+++ b/mercurial/templateutil.py Sat Mar 17 23:34:38 2018 +0900
@@ -200,7 +200,14 @@
return self.join(context, mapping, self._defaultsep)
def tovalue(self, context, mapping):
- return list(self.itermaps(context))
+ knownres = context.knownresourcekeys()
+ items = []
+ for nm in self.itermaps(context):
+ # drop internal resources (recursively) which shouldn't be displayed
+ lm = context.overlaymap(mapping, nm)
+ items.append({k: unwrapvalue(context, lm, v)
+ for k, v in nm.iteritems() if k not in knownres})
+ return items
class mappinggenerator(_mappingsequence):
"""Wrapper for generator of template mappings
--- a/tests/test-annotate.t Thu Mar 15 21:09:37 2018 +0900
+++ b/tests/test-annotate.t Sat Mar 17 23:34:38 2018 +0900
@@ -105,6 +105,8 @@
several filters can be applied to '{lines}'
+ $ hg annotate -T'{lines|json}\n' a
+ [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}]
$ hg annotate -T'{lines|stringify}' a
0: a
1: a