diff mercurial/templateutil.py @ 37070:1101d6747d2d

templater: drop 'templ' from resources dict Partially resolves cycle, templ -> context -> templ. This will make it easier to replace the resources dict with new immutable resource mapper interface.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 16 Mar 2018 23:09:21 +0900
parents aa97e06a1912
children 44757e6dad93
line wrap: on
line diff
--- a/mercurial/templateutil.py	Fri Mar 16 23:01:51 2018 +0900
+++ b/mercurial/templateutil.py	Fri Mar 16 23:09:21 2018 +0900
@@ -348,8 +348,11 @@
             v = default
     if callable(v) and getattr(v, '_requires', None) is None:
         # old templatekw: expand all keywords and resources
+        # (TODO: deprecate this after porting web template keywords to new API)
         props = {k: f(context, mapping, k)
                  for k, f in context._resources.items()}
+        # pass context to _showcompatlist() through templatekw._showlist()
+        props['templ'] = context
         props.update(mapping)
         return v(**pycompat.strkwargs(props))
     if callable(v):