mercurial/cmdutil.py
changeset 32838 615ec3f14aa9
parent 32837 50586a0a946f
child 32839 b425ec7fb7f6
--- a/mercurial/cmdutil.py	Sat Apr 22 18:42:03 2017 +0900
+++ b/mercurial/cmdutil.py	Sat Apr 22 18:48:38 2017 +0900
@@ -1580,7 +1580,8 @@
 
     def __init__(self, ui, repo, matchfn, diffopts, tmpl, mapfile, buffered):
         changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
-        self.t = formatter.loadtemplater(ui, 'changeset', (tmpl, mapfile),
+        tmplspec = logtemplatespec(tmpl, mapfile)
+        self.t = formatter.loadtemplater(ui, 'changeset', tmplspec,
                                          cache=templatekw.defaulttempl)
         self._counter = itertools.count()
         self.cache = {}
@@ -1646,6 +1647,8 @@
                 self.footer = templater.stringify(
                     self.t(self._parts['footer'], **props))
 
+logtemplatespec = formatter.templatespec
+
 def _lookuplogtemplate(ui, tmpl, style):
     """Find the template matching the given template spec or style
 
@@ -1656,7 +1659,7 @@
     if not tmpl and not style: # template are stronger than style
         tmpl = ui.config('ui', 'logtemplate')
         if tmpl:
-            return templater.unquotestring(tmpl), None
+            return logtemplatespec(templater.unquotestring(tmpl), None)
         else:
             style = util.expandpath(ui.config('ui', 'style', ''))
 
@@ -1667,10 +1670,10 @@
                        or templater.templatepath(mapfile))
             if mapname:
                 mapfile = mapname
-        return None, mapfile
+        return logtemplatespec(None, mapfile)
 
     if not tmpl:
-        return None, None
+        return logtemplatespec(None, None)
 
     return formatter.lookuptemplate(ui, 'changeset', tmpl)