[PATCH] formatter: look for template symbols from the associated name

Yuya Nishihara yuya at tcha.org
Fri Jun 22 12:48:59 UTC 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1529326684 -32400
#      Mon Jun 18 21:58:04 2018 +0900
# Node ID c0e6ac4fb15dc8b00137c234150f5dbc77c90e4d
# Parent  42e236fe9560b8ad81fd59584e8ee7f6ce7442b7
formatter: look for template symbols from the associated name

Otherwise symbolsused() would fail if a named template is specified with -T.

diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -420,7 +420,7 @@ class templateformatter(baseformatter):
 
     @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
diff --git a/tests/test-annotate.t b/tests/test-annotate.t
--- a/tests/test-annotate.t
+++ b/tests/test-annotate.t
@@ -80,6 +80,9 @@ log-like templating
 
   $ 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


More information about the Mercurial-devel mailing list