comparison mercurial/cmdutil.py @ 32832:11e667a8fcba

formatter: factor out function to create templater from literal or map file (tmpl, mapfile) will be packed into a named tuple later.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 22 Apr 2017 15:06:06 +0900
parents de7dc25ecf2e
children edde2e974ed0
comparison
equal deleted inserted replaced
32831:de7dc25ecf2e 32832:11e667a8fcba
1578 class changeset_templater(changeset_printer): 1578 class changeset_templater(changeset_printer):
1579 '''format changeset information.''' 1579 '''format changeset information.'''
1580 1580
1581 def __init__(self, ui, repo, matchfn, diffopts, tmpl, mapfile, buffered): 1581 def __init__(self, ui, repo, matchfn, diffopts, tmpl, mapfile, buffered):
1582 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered) 1582 changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered)
1583 assert not (tmpl and mapfile) 1583 self.t = formatter.loadtemplater(ui, 'changeset', (tmpl, mapfile),
1584 defaulttempl = templatekw.defaulttempl 1584 cache=templatekw.defaulttempl)
1585 if mapfile:
1586 self.t = templater.templater.frommapfile(mapfile,
1587 cache=defaulttempl)
1588 else:
1589 self.t = formatter.maketemplater(ui, 'changeset', tmpl,
1590 cache=defaulttempl)
1591
1592 self._counter = itertools.count() 1585 self._counter = itertools.count()
1593 self.cache = {} 1586 self.cache = {}
1594 1587
1595 # find correct templates for current mode 1588 # find correct templates for current mode
1596 tmplmodes = [ 1589 tmplmodes = [