mercurial/formatter.py
changeset 43099 f1c5358f0d65
parent 43077 687b865b95ad
child 43100 90b9a7e06c2c
--- a/mercurial/formatter.py	Sat Oct 05 15:47:38 2019 -0400
+++ b/mercurial/formatter.py	Sat Oct 05 23:04:45 2019 -0400
@@ -475,10 +475,9 @@
 
 
 class templateformatter(baseformatter):
-    def __init__(self, ui, out, topic, opts):
+    def __init__(self, ui, out, topic, opts, spec):
         baseformatter.__init__(self, ui, topic, opts, _templateconverter)
         self._out = out
-        spec = lookuptemplate(ui, topic, opts.get(b'template', b''))
         self._tref = spec.ref
         self._t = loadtemplater(
             ui,
@@ -723,7 +722,8 @@
     elif template == b"debug":
         return debugformatter(ui, out, topic, opts)
     elif template != b"":
-        return templateformatter(ui, out, topic, opts)
+        spec = lookuptemplate(ui, topic, opts.get(b'template', b''))
+        return templateformatter(ui, out, topic, opts, spec)
     # developer config: ui.formatdebug
     elif ui.configbool(b'ui', b'formatdebug'):
         return debugformatter(ui, out, topic, opts)