diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -214,6 +214,8 @@ class templater(object): if not t in self.cache: try: self.cache[t] = open(self.map[t][1]).read() + except KeyError, inst: + raise util.Abort(_('"%s" not in template map') % inst.args[0]) except IOError, inst: raise IOError(inst.args[0], _('template file %s: %s') % (self.map[t][1], inst.args[1])) diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -449,7 +449,7 @@ Error if style missing key: $ echo 'q = q' > t $ hg log --style ./t - abort: ./t: no key named 'changeset' + abort: "changeset" not in template map [255] Error if include fails: