Mercurial > public > mercurial-scm > hg-stable
diff mercurial/templatekw.py @ 37073: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 | 724f2e21d870 |
children | d3f7930a9563 |
line wrap: on
line diff
--- a/mercurial/templatekw.py Fri Mar 16 23:01:51 2018 +0900 +++ b/mercurial/templatekw.py Fri Mar 16 23:09:21 2018 +0900 @@ -35,19 +35,8 @@ compatlist = templateutil.compatlist _showcompatlist = templateutil._showcompatlist -# TODO: temporary hack for porting; will be removed soon -class _fakecontextwrapper(object): - def __init__(self, templ): - self._templ = templ - - def preload(self, t): - return t in self._templ - - def process(self, t, mapping): - return self._templ.generatenamed(t, mapping) - def _showlist(name, values, templ, mapping, plural=None, separator=' '): - context = _fakecontextwrapper(templ) + context = templ # this is actually a template context, not a templater return _showcompatlist(context, mapping, name, values, plural, separator) def showdict(name, data, mapping, plural=None, key='key', value='value',