comparison mercurial/formatter.py @ 28384:3356bf61fa25

formatter: make labels work with templated output To describe the bug this fix is addressing, one can do ``$ hg status -T "{label('red', path)}\n" --color=debug`` and observe that the label is not applied before my fix and applied with it.
author Kostia Balytskyi <ikostia@fb.com>
date Tue, 08 Mar 2016 04:08:33 -0800
parents 56b2bcea2529
children bf35644b9f3a
comparison
equal deleted inserted replaced
28383:e13e0e189990 28384:3356bf61fa25
151 def __init__(self, ui, topic, opts): 151 def __init__(self, ui, topic, opts):
152 baseformatter.__init__(self, ui, topic, opts) 152 baseformatter.__init__(self, ui, topic, opts)
153 self._topic = topic 153 self._topic = topic
154 self._t = gettemplater(ui, topic, opts.get('template', '')) 154 self._t = gettemplater(ui, topic, opts.get('template', ''))
155 def _showitem(self): 155 def _showitem(self):
156 g = self._t(self._topic, **self._item) 156 g = self._t(self._topic, ui=self._ui, **self._item)
157 self._ui.write(templater.stringify(g)) 157 self._ui.write(templater.stringify(g))
158 158
159 def lookuptemplate(ui, topic, tmpl): 159 def lookuptemplate(ui, topic, tmpl):
160 # looks like a literal template? 160 # looks like a literal template?
161 if '{' in tmpl: 161 if '{' in tmpl: