diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -200,7 +200,14 @@ class _mappingsequence(wrapped): 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 diff --git a/tests/test-annotate.t b/tests/test-annotate.t --- a/tests/test-annotate.t +++ b/tests/test-annotate.t @@ -105,6 +105,8 @@ default output of '{lines}' should be re 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