Mercurial > hg
changeset 31805:dca9b6922514
formatter: reorder code that builds template mapping
This makes the future patch slightly simpler.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 02 Apr 2017 22:43:18 +0900 |
parents | 726f24123f02 |
children | 8f203b491bb5 |
files | mercurial/formatter.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/formatter.py Sun Apr 02 18:40:13 2017 -0700 +++ b/mercurial/formatter.py Sun Apr 02 22:43:18 2017 +0900 @@ -347,16 +347,16 @@ # TODO: add support for filectx. probably each template keyword or # function will have to declare dependent resources. e.g. # @templatekeyword(..., requires=('ctx',)) + props = {} if 'ctx' in self._item: - props = templatekw.keywords.copy() - # explicitly-defined fields precede templatekw - props.update(self._item) + props.update(templatekw.keywords) + # explicitly-defined fields precede templatekw + props.update(self._item) + if 'ctx' in self._item: # but template resources must be always available props['templ'] = self._t props['repo'] = props['ctx'].repo() props['revcache'] = {} - else: - props = self._item g = self._t(self._topic, ui=self._ui, cache=self._cache, **props) self._out.write(templater.stringify(g))