diff --git a/hgext/churn.py b/hgext/churn.py index 207ce9e06c..a6d1627e7c 100644 --- a/hgext/churn.py +++ b/hgext/churn.py @@ -19,7 +19,6 @@ from mercurial import ( cmdutil, commands, encoding, - error, patch, scmutil, util, @@ -34,12 +33,7 @@ command = cmdutil.command(cmdtable) testedwith = 'internal' def maketemplater(ui, repo, tmpl): - try: - t = cmdutil.changeset_templater(ui, repo, False, None, tmpl, - None, False) - except SyntaxError as inst: - raise error.Abort(inst.args[0]) - return t + return cmdutil.changeset_templater(ui, repo, False, None, tmpl, None, False) def changedlines(ui, repo, ctx1, ctx2, fns): added, removed = 0, 0 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py index 9eb11a2138..1b925d810e 100644 --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1532,8 +1532,6 @@ class changeset_templater(changeset_printer): except KeyError as inst: msg = _("%s: no key named '%s'") raise error.Abort(msg % (self.t.mapfile, inst.args[0])) - except SyntaxError as inst: - raise error.Abort('%s: %s' % (self.t.mapfile, inst.args[0])) def gettemplate(ui, tmpl, style): """ @@ -1590,12 +1588,7 @@ def show_changeset(ui, repo, opts, buffered=False): if not tmpl and not mapfile: return changeset_printer(ui, repo, matchfn, opts, buffered) - try: - t = changeset_templater(ui, repo, matchfn, opts, tmpl, mapfile, - buffered) - except SyntaxError as inst: - raise error.Abort(inst.args[0]) - return t + return changeset_templater(ui, repo, matchfn, opts, tmpl, mapfile, buffered) def showmarker(ui, marker, index=None): """utility function to display obsolescence marker in a readable way @@ -2843,10 +2836,7 @@ def buildcommittemplate(repo, ctx, subs, extramsg, tmpl): ui = repo.ui tmpl, mapfile = gettemplate(ui, tmpl, None) - try: - t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False) - except SyntaxError as inst: - raise error.Abort(inst.args[0]) + t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False) for k, v in repo.ui.configitems('committemplate'): if k != 'changeset': diff --git a/mercurial/templater.py b/mercurial/templater.py index f9c25ef00e..657b818c2d 100644 --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -978,13 +978,12 @@ class templater(object): for key, val in conf[''].items(): if not val: - raise SyntaxError(_('%s: missing value') % conf.source('', key)) + raise error.ParseError(_('missing value'), conf.source('', key)) if val[0] in "'\"": try: self.cache[key] = unquotestring(val) except SyntaxError as inst: - raise SyntaxError('%s: %s' % - (conf.source('', key), inst.args[0])) + raise error.ParseError(inst.args[0], conf.source('', key)) else: val = 'default', val if ':' in val[1]: diff --git a/tests/test-command-template.t b/tests/test-command-template.t index f2e762b608..239801cebd 100644 --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -1008,7 +1008,7 @@ Error if style missing value: $ echo 'changeset =' > t $ hg log --style t - abort: t:1: missing value + hg: parse error at t:1: missing value [255] Error if include fails: @@ -2508,7 +2508,7 @@ Error on syntax: $ echo 'x = "f' >> t $ hg log - abort: t:3: unmatched quotes + hg: parse error at t:3: unmatched quotes [255] $ hg log -T '{date'