Patchwork formatter: look for template symbols from the associated name

login
register
mail settings
Submitter Yuya Nishihara
Date June 22, 2018, 12:48 p.m.
Message ID <c0e6ac4fb15dc8b00137.1529671739@mimosa>
Download mbox | patch
Permalink /patch/32376/
State New
Headers show

Comments

Yuya Nishihara - June 22, 2018, 12:48 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.

Patch

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