changeset 38446:5b04a0c30f3f

formatter: look for template symbols from the associated name Otherwise symbolsused() would fail if a named template is specified with -T.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 18 Jun 2018 21:58:04 +0900
parents afa96dd5a483
children b6294c113794
files mercurial/formatter.py tests/test-annotate.t
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/formatter.py	Mon Jun 25 15:54:56 2018 +0530
+++ b/mercurial/formatter.py	Mon Jun 18 21:58:04 2018 +0900
@@ -420,7 +420,7 @@
 
     @util.propertycache
     def _symbolsused(self):
-        return self._t.symbolsuseddefault()
+        return self._t.symbolsused(self._tref)
 
     def contexthint(self, datafields):
         '''set of context object keys to be required by the template, given
--- a/tests/test-annotate.t	Mon Jun 25 15:54:56 2018 +0530
+++ b/tests/test-annotate.t	Mon Jun 18 21:58:04 2018 +0900
@@ -80,6 +80,9 @@
 
   $ hg annotate -T'{lines % "{rev}:{line_number}: {line}"}' a
   0:1: a
+  $ hg annotate -Ta a \
+  > --config templates.a='"{lines % "{rev}:{line_number}: {line}"}"'
+  0:1: a
 
   $ cat <<EOF >>a
   > a