comparison mercurial/cmdutil.py @ 28837:d54a7410307f

templater: drop deprecated handling of KeyError from changeset_templater It's been superseded by 09cde75e0613 and the previous patch. templater.mapfile is no longer used and removed.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 03 Apr 2016 11:23:31 +0900
parents 44611ad4fbd9
children 86db5cb55d46
comparison
equal deleted inserted replaced
28836:3f45488d70df 28837:d54a7410307f
1530 props['repo'] = self.repo 1530 props['repo'] = self.repo
1531 props['ui'] = self.repo.ui 1531 props['ui'] = self.repo.ui
1532 props['revcache'] = {'copies': copies} 1532 props['revcache'] = {'copies': copies}
1533 props['cache'] = self.cache 1533 props['cache'] = self.cache
1534 1534
1535 try: 1535 # write header
1536 # write header 1536 if self._parts['header']:
1537 if self._parts['header']: 1537 h = templater.stringify(self.t(self._parts['header'], **props))
1538 h = templater.stringify(self.t(self._parts['header'], **props)) 1538 if self.buffered:
1539 if self.buffered: 1539 self.header[ctx.rev()] = h
1540 self.header[ctx.rev()] = h 1540 else:
1541 else: 1541 if self.lastheader != h:
1542 if self.lastheader != h: 1542 self.lastheader = h
1543 self.lastheader = h 1543 self.ui.write(h)
1544 self.ui.write(h) 1544
1545 1545 # write changeset metadata, then patch if requested
1546 # write changeset metadata, then patch if requested 1546 key = self._parts['changeset']
1547 key = self._parts['changeset'] 1547 self.ui.write(templater.stringify(self.t(key, **props)))
1548 self.ui.write(templater.stringify(self.t(key, **props))) 1548 self.showpatch(ctx, matchfn)
1549 self.showpatch(ctx, matchfn) 1549
1550 1550 if self._parts['footer']:
1551 if self._parts['footer']: 1551 if not self.footer:
1552 if not self.footer: 1552 self.footer = templater.stringify(
1553 self.footer = templater.stringify( 1553 self.t(self._parts['footer'], **props))
1554 self.t(self._parts['footer'], **props))
1555 except KeyError as inst:
1556 msg = _("%s: no key named '%s'")
1557 raise error.Abort(msg % (self.t.mapfile, inst.args[0]))
1558 1554
1559 def gettemplate(ui, tmpl, style): 1555 def gettemplate(ui, tmpl, style):
1560 """ 1556 """
1561 Find the template matching the given template spec or style. 1557 Find the template matching the given template spec or style.
1562 """ 1558 """