@@ -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
@@ -1532,8 +1532,6 @@ class changeset_templater(changeset_prin
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, buffe
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,
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':
@@ -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]:
@@ -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'