changeset_templater: render template specified by templatespec tuple
authorYuya Nishihara <yuya@tcha.org>
Tue, 11 Apr 2017 21:38:24 +0900
changeset 32860 97a4d09f5140
parent 32859 883adaea9e80
child 32861 a470bbb4e3af
changeset_templater: render template specified by templatespec tuple
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Sat Apr 22 19:29:41 2017 +0900
+++ b/mercurial/cmdutil.py	Tue Apr 11 21:38:24 2017 +0900
@@ -1593,7 +1593,9 @@
             (self.ui.debugflag, 'debug'),
         ]
 
-        self._parts = {'header': '', 'footer': '', 'changeset': 'changeset',
+        self._tref = tmplspec.ref
+        self._parts = {'header': '', 'footer': '',
+                       tmplspec.ref: tmplspec.ref,
                        'docheader': '', 'docfooter': ''}
         for mode, postfix in tmplmodes:
             for t in self._parts:
@@ -1637,7 +1639,7 @@
                     self.ui.write(h)
 
         # write changeset metadata, then patch if requested
-        key = self._parts['changeset']
+        key = self._parts[self._tref]
         self.ui.write(templater.stringify(self.t(key, **props)))
         self.showpatch(ctx, matchfn)