mercurial/cmdutil.py
changeset 28954 f97a0bcfd7a1
parent 28904 80be5dbe6e74
child 28955 78759f78a44e
--- a/mercurial/cmdutil.py	Sun Apr 03 23:18:30 2016 +0900
+++ b/mercurial/cmdutil.py	Sun Apr 03 23:26:48 2016 +0900
@@ -1478,6 +1478,7 @@
     def __init__(self, ui, repo, matchfn, diffopts, tmpl, mapfile, buffered):
         changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
         formatnode = ui.debugflag and (lambda x: x) or (lambda x: x[:12])
+        filters = {'formatnode': formatnode}
         defaulttempl = {
             'parent': '{rev}:{node|formatnode} ',
             'manifest': '{rev}:{node|formatnode}',
@@ -1486,10 +1487,14 @@
             }
         # filecopy is preserved for compatibility reasons
         defaulttempl['filecopy'] = defaulttempl['file_copy']
-        self.t = templater.templater(mapfile, {'formatnode': formatnode},
-                                     cache=defaulttempl)
-        if tmpl:
-            self.t.cache['changeset'] = tmpl
+        assert not (tmpl and mapfile)
+        if mapfile:
+            self.t = templater.templater.frommapfile(mapfile, filters=filters,
+                                                     cache=defaulttempl)
+        else:
+            self.t = templater.templater(filters=filters, cache=defaulttempl)
+            if tmpl:
+                self.t.cache['changeset'] = tmpl
 
         self.cache = {}