diff mercurial/cmdutil.py @ 32965:3f07f12c6e10

changeset_templater: do not enable verbosity postfix for [templates] section Since this postfix hack exists only for backward compatibility, we don't need it for new [templates] section. This isn't a BC as templates defined in [templates] section weren't loaded until recently.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 22 Apr 2017 21:09:07 +0900
parents 74fa8753990b
children 050efe9a1644
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Sat Apr 22 21:06:11 2017 +0900
+++ b/mercurial/cmdutil.py	Sat Apr 22 21:09:07 2017 +0900
@@ -1584,23 +1584,24 @@
         self._counter = itertools.count()
         self.cache = {}
 
-        # find correct templates for current mode
-        tmplmodes = [
-            (True, ''),
-            (self.ui.verbose, '_verbose'),
-            (self.ui.quiet, '_quiet'),
-            (self.ui.debugflag, '_debug'),
-        ]
-
         self._tref = tmplspec.ref
         self._parts = {'header': '', 'footer': '',
                        tmplspec.ref: tmplspec.ref,
                        'docheader': '', 'docfooter': ''}
-        for mode, postfix in tmplmodes:
-            for t in self._parts:
-                cur = t + postfix
-                if mode and cur in self.t:
-                    self._parts[t] = cur
+        if tmplspec.mapfile:
+            # find correct templates for current mode, for backward
+            # compatibility with 'log -v/-q/--debug' using a mapfile
+            tmplmodes = [
+                (True, ''),
+                (self.ui.verbose, '_verbose'),
+                (self.ui.quiet, '_quiet'),
+                (self.ui.debugflag, '_debug'),
+            ]
+            for mode, postfix in tmplmodes:
+                for t in self._parts:
+                    cur = t + postfix
+                    if mode and cur in self.t:
+                        self._parts[t] = cur
 
         if self._parts['docheader']:
             self.ui.write(templater.stringify(self.t(self._parts['docheader'])))