changeset 32859:883adaea9e80

formatter: render template specified by templatespec tuple
author Yuya Nishihara <yuya@tcha.org>
date Sat, 22 Apr 2017 19:29:41 +0900
parents 57c13c0d1cde
children 97a4d09f5140
files mercurial/formatter.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/formatter.py	Sat Apr 22 19:07:00 2017 +0900
+++ b/mercurial/formatter.py	Sat Apr 22 19:29:41 2017 +0900
@@ -347,8 +347,8 @@
     def __init__(self, ui, out, topic, opts):
         baseformatter.__init__(self, ui, topic, opts, _templateconverter)
         self._out = out
-        self._topic = topic
         spec = lookuptemplate(ui, topic, opts.get('template', ''))
+        self._tref = spec.ref
         self._t = loadtemplater(ui, spec, cache=templatekw.defaulttempl)
         self._counter = itertools.count()
         self._cache = {}  # for templatekw/funcs to store reusable data
@@ -371,7 +371,7 @@
             props['templ'] = self._t
             props['repo'] = props['ctx'].repo()
             props['revcache'] = {}
-        g = self._t(self._topic, ui=self._ui, cache=self._cache, **props)
+        g = self._t(self._tref, ui=self._ui, cache=self._cache, **props)
         self._out.write(templater.stringify(g))
 
 templatespec = collections.namedtuple(r'templatespec',