Mercurial > public > mercurial-scm > hg
comparison mercurial/filemerge.py @ 35483:817a3d20dd01
templater: register keywords to defaults table
Since the keywords are permanent, there should be no need to pass them
by a temporary mapping.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 22 Dec 2017 21:19:29 +0900 |
parents | c240657febb7 |
children | c0439e11af16 |
comparison
equal
deleted
inserted
replaced
35482:c240657febb7 | 35483:817a3d20dd01 |
---|---|
550 can have aligned templated parts. | 550 can have aligned templated parts. |
551 """ | 551 """ |
552 if ctx.node() is None: | 552 if ctx.node() is None: |
553 ctx = ctx.p1() | 553 ctx = ctx.p1() |
554 | 554 |
555 props = templatekw.keywords.copy() | 555 props = {'ctx': ctx} |
556 props['ctx'] = ctx | |
557 templateresult = template.render(props) | 556 templateresult = template.render(props) |
558 | 557 |
559 label = ('%s:' % label).ljust(pad + 1) | 558 label = ('%s:' % label).ljust(pad + 1) |
560 mark = '%s %s' % (label, templateresult) | 559 mark = '%s %s' % (label, templateresult) |
561 | 560 |
578 | 577 |
579 ui = repo.ui | 578 ui = repo.ui |
580 template = ui.config('ui', 'mergemarkertemplate') | 579 template = ui.config('ui', 'mergemarkertemplate') |
581 template = templater.unquotestring(template) | 580 template = templater.unquotestring(template) |
582 tres = formatter.templateresources(ui, repo) | 581 tres = formatter.templateresources(ui, repo) |
583 tmpl = formatter.maketemplater(ui, template, resources=tres) | 582 tmpl = formatter.maketemplater(ui, template, defaults=templatekw.keywords, |
583 resources=tres) | |
584 | 584 |
585 pad = max(len(l) for l in labels) | 585 pad = max(len(l) for l in labels) |
586 | 586 |
587 newlabels = [_formatconflictmarker(cd, tmpl, labels[0], pad), | 587 newlabels = [_formatconflictmarker(cd, tmpl, labels[0], pad), |
588 _formatconflictmarker(co, tmpl, labels[1], pad)] | 588 _formatconflictmarker(co, tmpl, labels[1], pad)] |