diff --git a/mercurial/fileset.py b/mercurial/fileset.py --- a/mercurial/fileset.py +++ b/mercurial/fileset.py @@ -402,7 +402,7 @@ def _intree(funcs, tree): def getfileset(ctx, expr): tree, pos = parse(expr) if (pos != len(expr)): - raise error.ParseError("invalid token", pos) + raise error.ParseError(_("invalid token"), pos) # do we need status info? if _intree(['modified', 'added', 'removed', 'deleted', diff --git a/mercurial/parser.py b/mercurial/parser.py --- a/mercurial/parser.py +++ b/mercurial/parser.py @@ -16,6 +16,7 @@ # __call__(program) parses program into a labelled tree import error +from i18n import _ class parser(object): def __init__(self, tokenizer, elements, methods=None): @@ -34,7 +35,7 @@ class parser(object): def _match(self, m, pos): 'make sure the tokenizer matches an end condition' if self.current[0] != m: - raise error.ParseError("unexpected token: %s" % self.current[0], + raise error.ParseError(_("unexpected token: %s") % self.current[0], self.current[2]) self._advance() def _parse(self, bind=0): @@ -42,7 +43,7 @@ class parser(object): # handle prefix rules on current token prefix = self._elements[token][1] if not prefix: - raise error.ParseError("not a prefix: %s" % token, pos) + raise error.ParseError(_("not a prefix: %s") % token, pos) if len(prefix) == 1: expr = (prefix[0], value) else: @@ -64,7 +65,7 @@ class parser(object): else: # handle infix rules if len(e) < 3 or not e[2]: - raise error.ParseError("not an infix: %s" % token, pos) + raise error.ParseError(_("not an infix: %s") % token, pos) infix = e[2] if len(infix) == 3 and infix[2] == self.current[0]: self._match(infix[2], pos) diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -979,7 +979,7 @@ class revsetalias(object): value = value.replace(arg, repr(arg)) self.replacement, pos = parse(value) if pos != len(value): - raise error.ParseError('invalid token', pos) + raise error.ParseError(_('invalid token'), pos) else: self.replacement = value @@ -997,7 +997,8 @@ class revsetalias(object): (len(self.args) == 1 and tree[2][0] == 'list') or (len(self.args) > 1 and (tree[2][0] != 'list' or len(tree[2]) - 1 != len(self.args)))): - raise error.ParseError('invalid amount of arguments', len(tree) - 2) + raise error.ParseError(_('invalid amount of arguments'), + len(tree) - 2) return True def replace(self, tree): @@ -1033,7 +1034,7 @@ def match(ui, spec): raise error.ParseError(_("empty query")) tree, pos = parse(spec) if (pos != len(spec)): - raise error.ParseError("invalid token", pos) + raise error.ParseError(_("invalid token"), pos) tree = findaliases(ui, tree) weight, tree = optimize(tree, True) def mfunc(repo, subset):