changeset 32833:99df35499cae

formatter: inline gettemplater() Since it's highly use-case dependent how template should be looked up, gettemplater() function isn't useful. Keeping it would introduce another bug I've made and fixed earlier in this series.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 22 Apr 2017 15:11:53 +0900
parents 11e667a8fcba
children edde2e974ed0
files mercurial/formatter.py
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/formatter.py	Sat Apr 22 15:06:06 2017 +0900
+++ b/mercurial/formatter.py	Sat Apr 22 15:11:53 2017 +0900
@@ -347,8 +347,8 @@
         baseformatter.__init__(self, ui, topic, opts, _templateconverter)
         self._out = out
         self._topic = topic
-        self._t = gettemplater(ui, topic, opts.get('template', ''),
-                               cache=templatekw.defaulttempl)
+        spec = lookuptemplate(ui, topic, opts.get('template', ''))
+        self._t = loadtemplater(ui, topic, spec, cache=templatekw.defaulttempl)
         self._counter = itertools.count()
         self._cache = {}  # for templatekw/funcs to store reusable data
     def context(self, **ctxs):
@@ -406,10 +406,6 @@
     # constant string?
     return tmpl, None
 
-def gettemplater(ui, topic, spec, cache=None):
-    tmpl, mapfile = lookuptemplate(ui, topic, spec)
-    return loadtemplater(ui, topic, (tmpl, mapfile), cache=cache)
-
 def loadtemplater(ui, topic, spec, cache=None):
     """Create a templater from either a literal template or loading from
     a map file"""