diff mercurial/cmdutil.py @ 32873:2ecce24dfcd3

templater: add simple interface for unnamed template (API) This provides a simpler API for callers which don't need full templating stack. Instead of storing the given template as the name specified by topic, use '' as the default template to be rendered.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 22 Apr 2017 19:56:47 +0900
parents e4a43b810528
children c8f2cf18b82e
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Jun 14 20:56:34 2017 -0400
+++ b/mercurial/cmdutil.py	Sat Apr 22 19:56:47 2017 +0900
@@ -2297,7 +2297,7 @@
         return templatekw.showgraphnode  # fast path for "{graphnode}"
 
     spec = templater.unquotestring(spec)
-    templ = formatter.maketemplater(ui, 'graphnode', spec)
+    templ = formatter.maketemplater(ui, spec)
     cache = {}
     if isinstance(displayer, changeset_templater):
         cache = displayer.cache  # reuse cache of slow templates
@@ -2309,7 +2309,7 @@
         props['repo'] = repo
         props['ui'] = repo.ui
         props['revcache'] = {}
-        return templater.stringify(templ('graphnode', **props))
+        return templ.render(props)
     return formatnode
 
 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,