changeset 32876:8da65da039c3

formatter: always store a literal template unnamed Now spec.ref should be '' if spec.tmpl is specified. Since spec.ref is the option to select the initial template to be rendered, it doesn't make sense to store the given literal template as spec.ref.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 06 May 2017 17:03:59 +0900
parents c8f2cf18b82e
children 388e1242ed9e
files mercurial/formatter.py
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/formatter.py	Sat Apr 22 20:14:55 2017 +0900
+++ b/mercurial/formatter.py	Sat May 06 17:03:59 2017 +0900
@@ -433,19 +433,16 @@
     assert not (spec.tmpl and spec.mapfile)
     if spec.mapfile:
         return templater.templater.frommapfile(spec.mapfile, cache=cache)
-    return _maketemplater(ui, spec.ref, spec.tmpl, cache=cache)
+    return maketemplater(ui, spec.tmpl, cache=cache)
 
 def maketemplater(ui, tmpl, cache=None):
     """Create a templater from a string template 'tmpl'"""
-    return _maketemplater(ui, '', tmpl, cache=cache)
-
-def _maketemplater(ui, topic, tmpl, cache=None):
     aliases = ui.configitems('templatealias')
     t = templater.templater(cache=cache, aliases=aliases)
     t.cache.update((k, templater.unquotestring(v))
                    for k, v in ui.configitems('templates'))
     if tmpl:
-        t.cache[topic] = tmpl
+        t.cache[''] = tmpl
     return t
 
 def formatter(ui, out, topic, opts):