[PATCH 2 of 2] templater: drop deprecated handling of KeyError from changeset_templater
Yuya Nishihara
yuya at tcha.org
Fri Apr 8 11:57:05 EDT 2016
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1459650211 -32400
# Sun Apr 03 11:23:31 2016 +0900
# Node ID 0fb62a3160e5d12e2b8495c2fcf328fe1a9fdab0
# Parent 170ea5eb48ccdd68010c1a03d57702728f5d53cf
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.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1532,29 +1532,25 @@ class changeset_templater(changeset_prin
props['revcache'] = {'copies': copies}
props['cache'] = self.cache
- try:
- # write header
- if self._parts['header']:
- h = templater.stringify(self.t(self._parts['header'], **props))
- if self.buffered:
- self.header[ctx.rev()] = h
- else:
- if self.lastheader != h:
- self.lastheader = h
- self.ui.write(h)
-
- # write changeset metadata, then patch if requested
- key = self._parts['changeset']
- self.ui.write(templater.stringify(self.t(key, **props)))
- self.showpatch(ctx, matchfn)
-
- if self._parts['footer']:
- if not self.footer:
- self.footer = templater.stringify(
- self.t(self._parts['footer'], **props))
- except KeyError as inst:
- msg = _("%s: no key named '%s'")
- raise error.Abort(msg % (self.t.mapfile, inst.args[0]))
+ # write header
+ if self._parts['header']:
+ h = templater.stringify(self.t(self._parts['header'], **props))
+ if self.buffered:
+ self.header[ctx.rev()] = h
+ else:
+ if self.lastheader != h:
+ self.lastheader = h
+ self.ui.write(h)
+
+ # write changeset metadata, then patch if requested
+ key = self._parts['changeset']
+ self.ui.write(templater.stringify(self.t(key, **props)))
+ self.showpatch(ctx, matchfn)
+
+ if self._parts['footer']:
+ if not self.footer:
+ self.footer = templater.stringify(
+ self.t(self._parts['footer'], **props))
def gettemplate(ui, tmpl, style):
"""
diff --git a/mercurial/templater.py b/mercurial/templater.py
--- a/mercurial/templater.py
+++ b/mercurial/templater.py
@@ -956,7 +956,6 @@ class templater(object):
defaults = {}
if cache is None:
cache = {}
- self.mapfile = mapfile or 'template'
self.cache = cache.copy()
self.map = {}
if mapfile:
More information about the Mercurial-devel
mailing list