mercurial/formatter.py
changeset 35468 32c278eb876f
parent 34715 f17a0e18c47e
child 35469 f1c54d003327
--- a/mercurial/formatter.py	Thu Dec 21 21:03:25 2017 +0900
+++ b/mercurial/formatter.py	Thu Dec 21 21:29:06 2017 +0900
@@ -392,7 +392,6 @@
         props.update(item)
         if 'ctx' in item:
             # but template resources must be always available
-            props['templ'] = self._t
             props['repo'] = props['ctx'].repo()
             props['revcache'] = {}
         props = pycompat.strkwargs(props)
@@ -468,18 +467,19 @@
                 partsmap[part] = ref
     return partsmap
 
-def loadtemplater(ui, spec, cache=None):
+def loadtemplater(ui, spec, resources=None, cache=None):
     """Create a templater from either a literal template or loading from
     a map file"""
     assert not (spec.tmpl and spec.mapfile)
     if spec.mapfile:
-        return templater.templater.frommapfile(spec.mapfile, cache=cache)
-    return maketemplater(ui, spec.tmpl, cache=cache)
+        frommapfile = templater.templater.frommapfile
+        return frommapfile(spec.mapfile, resources=resources, cache=cache)
+    return maketemplater(ui, spec.tmpl, resources=resources, cache=cache)
 
-def maketemplater(ui, tmpl, cache=None):
+def maketemplater(ui, tmpl, resources=None, cache=None):
     """Create a templater from a string template 'tmpl'"""
     aliases = ui.configitems('templatealias')
-    t = templater.templater(cache=cache, aliases=aliases)
+    t = templater.templater(resources=resources, cache=cache, aliases=aliases)
     t.cache.update((k, templater.unquotestring(v))
                    for k, v in ui.configitems('templates'))
     if tmpl: