formatter: look for template symbols from the associated name
authorYuya Nishihara <yuya@tcha.org>
Mon, 18 Jun 2018 21:58:04 +0900
changeset 38446 5b04a0c30f3f
parent 38445 afa96dd5a483
child 38447 b6294c113794
formatter: look for template symbols from the associated name Otherwise symbolsused() would fail if a named template is specified with -T.
mercurial/formatter.py
tests/test-annotate.t
--- 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