Show More
@@ -1214,7 +1214,7 b' def debugpushkey(ui, repopath, namespace' | |||||
1214 | def debugrevspec(ui, repo, expr): |
|
1214 | def debugrevspec(ui, repo, expr): | |
1215 | '''parse and apply a revision specification''' |
|
1215 | '''parse and apply a revision specification''' | |
1216 | if ui.verbose: |
|
1216 | if ui.verbose: | |
1217 | tree = revset.parse(expr) |
|
1217 | tree = revset.parse(expr)[0] | |
1218 | ui.note(tree, "\n") |
|
1218 | ui.note(tree, "\n") | |
1219 | func = revset.match(expr) |
|
1219 | func = revset.match(expr) | |
1220 | for c in func(repo, range(len(repo))): |
|
1220 | for c in func(repo, range(len(repo))): |
@@ -78,7 +78,9 b' class parser(object):' | |||||
78 | 'generate a parse tree from a message' |
|
78 | 'generate a parse tree from a message' | |
79 | self._iter = self._tokenizer(message) |
|
79 | self._iter = self._tokenizer(message) | |
80 | self._advance() |
|
80 | self._advance() | |
81 |
re |
|
81 | res = self._parse() | |
|
82 | token, value, pos = self.current | |||
|
83 | return res, pos | |||
82 | def eval(self, tree): |
|
84 | def eval(self, tree): | |
83 | 'recursively evaluate a parse tree using node methods' |
|
85 | 'recursively evaluate a parse tree using node methods' | |
84 | if not isinstance(tree, tuple): |
|
86 | if not isinstance(tree, tuple): |
@@ -810,7 +810,9 b' parse = parser.parser(tokenize, elements' | |||||
810 | def match(spec): |
|
810 | def match(spec): | |
811 | if not spec: |
|
811 | if not spec: | |
812 | raise error.ParseError(_("empty query")) |
|
812 | raise error.ParseError(_("empty query")) | |
813 | tree = parse(spec) |
|
813 | tree, pos = parse(spec) | |
|
814 | if (pos != len(spec)): | |||
|
815 | raise error.ParseError("invalid token", pos) | |||
814 | weight, tree = optimize(tree, True) |
|
816 | weight, tree = optimize(tree, True) | |
815 | def mfunc(repo, subset): |
|
817 | def mfunc(repo, subset): | |
816 | return getset(repo, subset, tree) |
|
818 | return getset(repo, subset, tree) |
@@ -69,7 +69,6 b' def tokenizer(data):' | |||||
69 | else: |
|
69 | else: | |
70 | raise error.ParseError(_("syntax error"), pos) |
|
70 | raise error.ParseError(_("syntax error"), pos) | |
71 | pos += 1 |
|
71 | pos += 1 | |
72 | data[2] = pos |
|
|||
73 | yield ('end', None, pos) |
|
72 | yield ('end', None, pos) | |
74 |
|
73 | |||
75 | def compiletemplate(tmpl, context): |
|
74 | def compiletemplate(tmpl, context): | |
@@ -91,8 +90,8 b' def compiletemplate(tmpl, context):' | |||||
91 | parsed.append(("string", tmpl[pos:n])) |
|
90 | parsed.append(("string", tmpl[pos:n])) | |
92 |
|
91 | |||
93 | pd = [tmpl, n + 1, stop] |
|
92 | pd = [tmpl, n + 1, stop] | |
94 |
parse |
|
93 | parseres, pos = p.parse(pd) | |
95 | pos = pd[2] |
|
94 | parsed.append(parseres) | |
96 |
|
95 | |||
97 | return [compileexp(e, context) for e in parsed] |
|
96 | return [compileexp(e, context) for e in parsed] | |
98 |
|
97 |
@@ -356,3 +356,10 b' issue2437' | |||||
356 | 9 |
|
356 | 9 | |
357 | $ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(é)))' |
|
357 | $ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(é)))' | |
358 | 4 |
|
358 | 4 | |
|
359 | ||||
|
360 | issue2654: report a parse error if the revset was not completely parsed | |||
|
361 | ||||
|
362 | $ log '1 OR 2' | |||
|
363 | hg: parse error at 2: invalid token | |||
|
364 | [255] | |||
|
365 |
General Comments 0
You need to be logged in to leave comments.
Login now