changeset 25599:695b93a79d17

templater: comment that gettemplate() has different name resolution order I've tried to unify gettemplate() with buildtemplate(), but it didn't go well because gettemplate() have to bypass mapping dict. For example, web templates have '{tags%changelogtag}' and 'changelogtag' is defined in both mapping, the default, and context.cache, sourced from map file. In general, mapping shadows context variables, but gettemplate() have to pick it from context.cache.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 16 Jun 2015 22:13:19 +0900
parents 55c2cb65bdfa
children 70ac1868b707
files mercurial/templater.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Sat Jun 13 20:23:52 2015 +0900
+++ b/mercurial/templater.py	Tue Jun 16 22:13:19 2015 +0900
@@ -147,6 +147,9 @@
     if exp[0] == 'template':
         return compiletemplate(exp[1], context)
     if exp[0] == 'symbol':
+        # unlike runsymbol(), here 'symbol' is always taken as template name
+        # even if it exists in mapping. this allows us to override mapping
+        # by web templates, e.g. 'changelogtag' is redefined in map file.
         return context._load(exp[1])
     raise error.ParseError(_("expected template specifier"))