diff mercurial/templatekw.py @ 37106:be3f33f5e232

templater: switch 'revcache' based on new mapping items It was pretty easy to leave a stale 'revcache' when switching 'ctx'. Let's make it be automatically replaced.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 15 Mar 2018 21:52:47 +0900
parents f0b6fbea00cf
children 45987e2b64f0
line wrap: on
line diff
--- a/mercurial/templatekw.py	Thu Mar 15 21:49:33 2018 +0900
+++ b/mercurial/templatekw.py	Thu Mar 15 21:52:47 2018 +0900
@@ -583,7 +583,7 @@
     predecessors = map(hex, predecessors)
 
     return _hybrid(None, predecessors,
-                   lambda x: {'ctx': repo[x], 'revcache': {}},
+                   lambda x: {'ctx': repo[x]},
                    lambda x: scmutil.formatchangeid(repo[x]))
 
 @templatekeyword('reporoot', requires={'repo'})
@@ -607,7 +607,7 @@
 
     data = []
     for ss in ssets:
-        h = _hybrid(None, ss, lambda x: {'ctx': repo[x], 'revcache': {}},
+        h = _hybrid(None, ss, lambda x: {'ctx': repo[x]},
                     lambda x: scmutil.formatchangeid(repo[x]))
         data.append(h)
 
@@ -647,7 +647,7 @@
 
         successors = [hex(n) for n in successors]
         successors = _hybrid(None, successors,
-                             lambda x: {'ctx': repo[x], 'revcache': {}},
+                             lambda x: {'ctx': repo[x]},
                              lambda x: scmutil.formatchangeid(repo[x]))
 
         # Format markers
@@ -710,7 +710,7 @@
                 ('phase', p.phasestr())]
                for p in pctxs]
     f = _showcompatlist(context, mapping, 'parent', parents)
-    return _hybrid(f, prevs, lambda x: {'ctx': repo[x], 'revcache': {}},
+    return _hybrid(f, prevs, lambda x: {'ctx': repo[x]},
                    lambda x: scmutil.formatchangeid(repo[x]), keytype=int)
 
 @templatekeyword('phase', requires={'ctx'})
@@ -737,7 +737,7 @@
     repo = context.resource(mapping, 'repo')
     f = _showcompatlist(context, mapping, name, ['%d' % r for r in revs])
     return _hybrid(f, revs,
-                   lambda x: {name: x, 'ctx': repo[x], 'revcache': {}},
+                   lambda x: {name: x, 'ctx': repo[x]},
                    pycompat.identity, keytype=int)
 
 @templatekeyword('subrepos', requires={'ctx'})