Mercurial > hg-stable
changeset 37075:d64ae4fef471
log: do no expect templateresources() returning a dict
The resources dict will be replaced with new resource mapper object, which
won't implement __getitem__(key). Share the whole resources object with
_graphnodeformater() to make porting easier.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 15 Mar 2018 20:27:38 +0900 |
parents | d3f7930a9563 |
children | 44757e6dad93 |
files | mercurial/logcmdutil.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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):