Mercurial > public > mercurial-scm > hg
comparison mercurial/formatter.py @ 37075:46859b437697
templater: drop symbols which should be overridden by new 'ctx' (issue5612)
This problem is caused by impedance mismatch between the templater and the
formatter interface, which is that the template keywords are generally
evaluated dynamically, but the formatter puts static values into a template
mapping.
This patch avoids the problem by removing conflicting values from a mapping
dict when a 'ctx' is switched.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 15 Mar 2018 21:38:57 +0900 |
parents | 44757e6dad93 |
children | 638a241202a3 |
comparison
equal
deleted
inserted
replaced
37074:2891079fb0c0 | 37075:46859b437697 |
---|---|
502 'cache': {}, # for templatekw/funcs to store reusable data | 502 'cache': {}, # for templatekw/funcs to store reusable data |
503 'repo': repo, | 503 'repo': repo, |
504 'ui': ui, | 504 'ui': ui, |
505 } | 505 } |
506 | 506 |
507 def availablekeys(self, context, mapping): | |
508 return {k for k, g in self._gettermap.iteritems() | |
509 if g(self, context, mapping, k) is not None} | |
510 | |
507 def knownkeys(self): | 511 def knownkeys(self): |
508 return self._knownkeys | 512 return self._knownkeys |
509 | 513 |
510 def lookup(self, context, mapping, key): | 514 def lookup(self, context, mapping, key): |
511 get = self._gettermap.get(key) | 515 get = self._gettermap.get(key) |