Mercurial > hg
comparison mercurial/logcmdutil.py @ 37103:be3f33f5e232
templater: switch 'revcache' based on new mapping items
It was pretty easy to leave a stale 'revcache' when switching 'ctx'.
Let's make it be automatically replaced.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 15 Mar 2018 21:52:47 +0900 |
parents | f0b6fbea00cf |
children | 8c48a3c088a7 |
comparison
equal
deleted
inserted
replaced
37102:638a241202a3 | 37103:be3f33f5e232 |
---|---|
286 # TODO: do not depend on templater | 286 # TODO: do not depend on templater |
287 tres = formatter.templateresources(self.repo.ui, self.repo) | 287 tres = formatter.templateresources(self.repo.ui, self.repo) |
288 t = formatter.maketemplater(self.repo.ui, '{join(obsfate, "\n")}', | 288 t = formatter.maketemplater(self.repo.ui, '{join(obsfate, "\n")}', |
289 defaults=templatekw.keywords, | 289 defaults=templatekw.keywords, |
290 resources=tres) | 290 resources=tres) |
291 obsfate = t.renderdefault({'ctx': ctx, 'revcache': {}}).splitlines() | 291 obsfate = t.renderdefault({'ctx': ctx}).splitlines() |
292 | 292 |
293 if obsfate: | 293 if obsfate: |
294 for obsfateline in obsfate: | 294 for obsfateline in obsfate: |
295 self.ui.write(self._columns['obsolete'] % obsfateline, | 295 self.ui.write(self._columns['obsolete'] % obsfateline, |
296 label='log.obsfate') | 296 label='log.obsfate') |
854 else: | 854 else: |
855 tres = formatter.templateresources(ui) | 855 tres = formatter.templateresources(ui) |
856 templ = formatter.maketemplater(ui, spec, defaults=templatekw.keywords, | 856 templ = formatter.maketemplater(ui, spec, defaults=templatekw.keywords, |
857 resources=tres) | 857 resources=tres) |
858 def formatnode(repo, ctx): | 858 def formatnode(repo, ctx): |
859 props = {'ctx': ctx, 'repo': repo, 'revcache': {}} | 859 props = {'ctx': ctx, 'repo': repo} |
860 return templ.renderdefault(props) | 860 return templ.renderdefault(props) |
861 return formatnode | 861 return formatnode |
862 | 862 |
863 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None, props=None): | 863 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None, props=None): |
864 props = props or {} | 864 props = props or {} |