comparison mercurial/cmdutil.py @ 32842:97a4d09f5140

changeset_templater: render template specified by templatespec tuple
author Yuya Nishihara <yuya@tcha.org>
date Tue, 11 Apr 2017 21:38:24 +0900
parents 57c13c0d1cde
children e4a43b810528
comparison
equal deleted inserted replaced
32841:883adaea9e80 32842:97a4d09f5140
1591 (self.ui.verbose, 'verbose'), 1591 (self.ui.verbose, 'verbose'),
1592 (self.ui.quiet, 'quiet'), 1592 (self.ui.quiet, 'quiet'),
1593 (self.ui.debugflag, 'debug'), 1593 (self.ui.debugflag, 'debug'),
1594 ] 1594 ]
1595 1595
1596 self._parts = {'header': '', 'footer': '', 'changeset': 'changeset', 1596 self._tref = tmplspec.ref
1597 self._parts = {'header': '', 'footer': '',
1598 tmplspec.ref: tmplspec.ref,
1597 'docheader': '', 'docfooter': ''} 1599 'docheader': '', 'docfooter': ''}
1598 for mode, postfix in tmplmodes: 1600 for mode, postfix in tmplmodes:
1599 for t in self._parts: 1601 for t in self._parts:
1600 cur = t 1602 cur = t
1601 if postfix: 1603 if postfix:
1635 if self.lastheader != h: 1637 if self.lastheader != h:
1636 self.lastheader = h 1638 self.lastheader = h
1637 self.ui.write(h) 1639 self.ui.write(h)
1638 1640
1639 # write changeset metadata, then patch if requested 1641 # write changeset metadata, then patch if requested
1640 key = self._parts['changeset'] 1642 key = self._parts[self._tref]
1641 self.ui.write(templater.stringify(self.t(key, **props))) 1643 self.ui.write(templater.stringify(self.t(key, **props)))
1642 self.showpatch(ctx, matchfn) 1644 self.showpatch(ctx, matchfn)
1643 1645
1644 if self._parts['footer']: 1646 if self._parts['footer']:
1645 if not self.footer: 1647 if not self.footer: