comparison mercurial/logcmdutil.py @ 36517:69477bac8926

log: do not invoke templatekw.showobsfate() as a function Prepares for switching to the (context, mapping) API. I tried, but it appeared not an one-off change to extract a non-template function from showobsfate(), which deeply depends on the templater internals.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 25 Feb 2018 14:42:18 +0900
parents 6ad140dc4269
children c6061cadb400
comparison
equal deleted inserted replaced
36516:9e3c37c367af 36517:69477bac8926
276 self.ui.write("\n") 276 self.ui.write("\n")
277 277
278 self._showpatch(ctx) 278 self._showpatch(ctx)
279 279
280 def _showobsfate(self, ctx): 280 def _showobsfate(self, ctx):
281 obsfate = templatekw.showobsfate(repo=self.repo, ctx=ctx, ui=self.ui) 281 # TODO: do not depend on templater
282 tres = formatter.templateresources(self.repo.ui, self.repo)
283 t = formatter.maketemplater(self.repo.ui, '{join(obsfate, "\n")}',
284 defaults=templatekw.keywords,
285 resources=tres)
286 obsfate = t.render({'ctx': ctx, 'revcache': {}}).splitlines()
282 287
283 if obsfate: 288 if obsfate:
284 for obsfateline in obsfate: 289 for obsfateline in obsfate:
285 self.ui.write(self._columns['obsolete'] % obsfateline, 290 self.ui.write(self._columns['obsolete'] % obsfateline,
286 label='log.obsfate') 291 label='log.obsfate')