diff mercurial/cmdutil.py @ 35468:32c278eb876f

templater: keep default resources per template engine (API) This allows us to register a repo object as a resource in hgweb template, without loosing '{repo}' symbol: symbol('repo') -> mapping['repo'] (n/a) -> defaults['repo'] resource('repo') -> mapping['repo'] (n/a) -> resources['repo'] I'm thinking of redesigning the templatekw API to take (context, mapping) in place of **(context._resources + mapping), but that will be a big change and not implemented yet. props['templ'] is ported to the resources dict as an example. .. api:: mapping does not contain all template resources. use context.resource() in template functions.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 21 Dec 2017 21:29:06 +0900
parents 5bec509dc1ff
children f1c54d003327
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Thu Dec 21 21:03:25 2017 +0900
+++ b/mercurial/cmdutil.py	Thu Dec 21 21:29:06 2017 +0900
@@ -1886,7 +1886,6 @@
         '''show a single changeset or file revision'''
         props = props.copy()
         props.update(templatekw.keywords)
-        props['templ'] = self.t
         props['ctx'] = ctx
         props['repo'] = self.repo
         props['ui'] = self.repo.ui
@@ -2663,7 +2662,6 @@
     if isinstance(displayer, changeset_templater):
         cache = displayer.cache  # reuse cache of slow templates
     props = templatekw.keywords.copy()
-    props['templ'] = templ
     props['cache'] = cache
     def formatnode(repo, ctx):
         props['ctx'] = ctx