Patchwork [4,of,6] formatter: always store a literal template unnamed

mail settings
Submitter Yuya Nishihara
Date June 16, 2017, 4:37 p.m.
Message ID <0ceb0e2fca59fc365567.1497631030@mimosa>
Download mbox | patch
Permalink /patch/21431/
State Accepted
Headers show


Yuya Nishihara - June 16, 2017, 4:37 p.m.
# HG changeset patch
# User Yuya Nishihara <>
# Date 1494057839 -32400
#      Sat May 06 17:03:59 2017 +0900
# Node ID 0ceb0e2fca59fc3655671eef60ed3829b2d768a3
# Parent  32ea66830e68419c6c97c0bcfc53f053f628b399
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.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -433,19 +433,16 @@  def loadtemplater(ui, spec, cache=None):
     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):