Show More
@@ -357,23 +357,28 b' class templateformatter(baseformatter):' | |||
|
357 | 357 | ctxs = pycompat.byteskwargs(ctxs) |
|
358 | 358 | assert all(k == 'ctx' for k in ctxs) |
|
359 | 359 | self._item.update(ctxs) |
|
360 | ||
|
360 | 361 | def _showitem(self): |
|
362 | item = self._item.copy() | |
|
363 | item['index'] = next(self._counter) | |
|
364 | self._renderitem(self._tref, item) | |
|
365 | ||
|
366 | def _renderitem(self, ref, item): | |
|
361 | 367 | # TODO: add support for filectx. probably each template keyword or |
|
362 | 368 | # function will have to declare dependent resources. e.g. |
|
363 | 369 | # @templatekeyword(..., requires=('ctx',)) |
|
364 | 370 | props = {} |
|
365 |
if 'ctx' in |
|
|
371 | if 'ctx' in item: | |
|
366 | 372 | props.update(templatekw.keywords) |
|
367 | props['index'] = next(self._counter) | |
|
368 | 373 | # explicitly-defined fields precede templatekw |
|
369 |
props.update( |
|
|
370 |
if 'ctx' in |
|
|
374 | props.update(item) | |
|
375 | if 'ctx' in item: | |
|
371 | 376 | # but template resources must be always available |
|
372 | 377 | props['templ'] = self._t |
|
373 | 378 | props['repo'] = props['ctx'].repo() |
|
374 | 379 | props['revcache'] = {} |
|
375 | 380 | props = pycompat.strkwargs(props) |
|
376 |
g = self._t( |
|
|
381 | g = self._t(ref, ui=self._ui, cache=self._cache, **props) | |
|
377 | 382 | self._out.write(templater.stringify(g)) |
|
378 | 383 | |
|
379 | 384 | templatespec = collections.namedtuple(r'templatespec', |
General Comments 0
You need to be logged in to leave comments.
Login now