Patchwork [5,of,6] formatter: render template specified by templatespec tuple

login
register
mail settings
Submitter Yuya Nishihara
Date June 15, 2017, 2:52 p.m.
Message ID <5befb37abfc78fc57524.1497538351@mimosa>
Download mbox | patch
Permalink /patch/21392/
State Accepted
Headers show

Comments

Yuya Nishihara - June 15, 2017, 2:52 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1492856981 -32400
#      Sat Apr 22 19:29:41 2017 +0900
# Node ID 5befb37abfc78fc575246560ae6358386a700887
# Parent  5b3af6e677d49f273caeb3c1f7c6412865f264f9
formatter: render template specified by templatespec tuple

Patch

diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -347,8 +347,8 @@  class templateformatter(baseformatter):
     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 @@  class templateformatter(baseformatter):
             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',