comparison hgext/histedit.py @ 45858:62983988bbf5

histedit: disable color while rendering template for use in plan Differential Revision: https://phab.mercurial-scm.org/D9324
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 16 Nov 2020 10:30:53 -0800
parents ec6ba70be853
children f4065c3f09b8
comparison
equal deleted inserted replaced
45857:ec6ba70be853 45858:62983988bbf5
523 by default lines are in the form: 523 by default lines are in the form:
524 <hash> <rev> <summary> 524 <hash> <rev> <summary>
525 """ 525 """
526 ctx = self.repo[self.node] 526 ctx = self.repo[self.node]
527 ui = self.repo.ui 527 ui = self.repo.ui
528 with ui.configoverride({}, b'histedit'): 528 # We don't want color codes in the commit message template, so
529 # disable the label() template function while we render it.
530 with ui.configoverride(
531 {(b'templatealias', b'label(l,x)'): b"x"}, b'histedit'
532 ):
529 summary = cmdutil.rendertemplate( 533 summary = cmdutil.rendertemplate(
530 ctx, ui.config(b'histedit', b'summary-template') 534 ctx, ui.config(b'histedit', b'summary-template')
531 ) 535 )
532 summary = summary.splitlines()[0] 536 summary = summary.splitlines()[0]
533 line = b'%s %s %s' % (self.verb, ctx, summary) 537 line = b'%s %s %s' % (self.verb, ctx, summary)