mercurial/logcmdutil.py
changeset 37072 d64ae4fef471
parent 36989 de117f579431
child 37084 f0b6fbea00cf
--- a/mercurial/logcmdutil.py	Fri Mar 16 23:11:55 2018 +0900
+++ b/mercurial/logcmdutil.py	Thu Mar 15 20:27:38 2018 +0900
@@ -416,13 +416,13 @@
     def __init__(self, ui, repo, tmplspec, differ=None, diffopts=None,
                  buffered=False):
         changesetprinter.__init__(self, ui, repo, differ, diffopts, buffered)
-        tres = formatter.templateresources(ui, repo)
+        # tres is shared with _graphnodeformatter()
+        self._tresources = tres = formatter.templateresources(ui, repo)
         self.t = formatter.loadtemplater(ui, tmplspec,
                                          defaults=templatekw.keywords,
                                          resources=tres,
                                          cache=templatekw.defaulttempl)
         self._counter = itertools.count()
-        self._getcache = tres['cache']  # shared with _graphnodeformatter()
 
         self._tref = tmplspec.ref
         self._parts = {'header': '', 'footer': '',
@@ -844,10 +844,11 @@
         return templatekw.getgraphnode  # fast path for "{graphnode}"
 
     spec = templater.unquotestring(spec)
-    tres = formatter.templateresources(ui)
     if isinstance(displayer, changesettemplater):
         # reuse cache of slow templates
-        tres['cache'] = displayer._getcache
+        tres = displayer._tresources
+    else:
+        tres = formatter.templateresources(ui)
     templ = formatter.maketemplater(ui, spec, defaults=templatekw.keywords,
                                     resources=tres)
     def formatnode(repo, ctx):