diff mercurial/formatter.py @ 36989:de117f579431

templater: factor out helper that renders named template as string This is quite common in non-web templating, and **kwargs expansion is annoying because of the unicode-ness of Python3.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 16 Mar 2018 21:24:12 +0900
parents 939e0983c1d9
children 44757e6dad93
line wrap: on
line diff
--- a/mercurial/formatter.py	Sat Mar 17 11:23:04 2018 +0900
+++ b/mercurial/formatter.py	Fri Mar 16 21:24:12 2018 +0900
@@ -401,9 +401,7 @@
         if 'ctx' in item or 'fctx' in item:
             # but template resources must be always available
             props['revcache'] = {}
-        props = pycompat.strkwargs(props)
-        g = self._t(ref, **props)
-        self._out.write(templateutil.stringify(g))
+        self._out.write(self._t.render(ref, props))
 
     def end(self):
         baseformatter.end(self)