Show More
@@ -539,7 +539,21 b' def foldconcat(tree):' | |||||
539 | return tuple(foldconcat(t) for t in tree) |
|
539 | return tuple(foldconcat(t) for t in tree) | |
540 |
|
540 | |||
541 | def parse(spec, lookup=None): |
|
541 | def parse(spec, lookup=None): | |
|
542 | try: | |||
542 | return _parsewith(spec, lookup=lookup) |
|
543 | return _parsewith(spec, lookup=lookup) | |
|
544 | except error.ParseError as inst: | |||
|
545 | if len(inst.args) > 1: # has location | |||
|
546 | # Add 1 to location because unlike templates, revset parse errors | |||
|
547 | # point to the char where the error happened, not the char after. | |||
|
548 | loc = inst.args[1] + 1 | |||
|
549 | # Remove newlines -- spaces are equivalent whitespace. | |||
|
550 | spec = spec.replace('\n', ' ') | |||
|
551 | # We want the caret to point to the place in the template that | |||
|
552 | # failed to parse, but in a hint we get a open paren at the | |||
|
553 | # start. Therefore, we print "loc + 1" spaces (instead of "loc") | |||
|
554 | # to line up the caret with the location of the error. | |||
|
555 | inst.hint = spec + '\n' + ' ' * loc + '^ ' + _('here') | |||
|
556 | raise | |||
543 |
|
557 | |||
544 | def _quote(s): |
|
558 | def _quote(s): | |
545 | r"""Quote a value in order to make it safe for the revset engine. |
|
559 | r"""Quote a value in order to make it safe for the revset engine. |
@@ -814,6 +814,8 b' check error cases' | |||||
814 | [255] |
|
814 | [255] | |
815 | $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=[1])' |
|
815 | $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=[1])' | |
816 | hg: parse error at 43: not a prefix: [ |
|
816 | hg: parse error at 43: not a prefix: [ | |
|
817 | (followlines(baz, 2:4, startrev=20, descend=[1]) | |||
|
818 | ^ here) | |||
817 | [255] |
|
819 | [255] | |
818 | $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=a)' |
|
820 | $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=a)' | |
819 | hg: parse error: descend argument must be a boolean |
|
821 | hg: parse error: descend argument must be a boolean |
@@ -142,6 +142,8 b' Invalid :pushrev raises appropriately' | |||||
142 | $ hg --config 'paths.default:pushrev=(' push |
|
142 | $ hg --config 'paths.default:pushrev=(' push | |
143 | pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob) |
|
143 | pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob) | |
144 | hg: parse error at 1: not a prefix: end |
|
144 | hg: parse error at 1: not a prefix: end | |
|
145 | (( | |||
|
146 | ^ here) | |||
145 | [255] |
|
147 | [255] | |
146 |
|
148 | |||
147 | $ cd .. |
|
149 | $ cd .. |
@@ -666,7 +666,11 b' Empty revset will error at the revset la' | |||||
666 |
|
666 | |||
667 | $ fileset "status(' ', '4', added())" |
|
667 | $ fileset "status(' ', '4', added())" | |
668 | hg: parse error at 1: not a prefix: end |
|
668 | hg: parse error at 1: not a prefix: end | |
|
669 | ( | |||
|
670 | ^ here) | |||
669 | [255] |
|
671 | [255] | |
670 | $ fileset "status('2', ' ', added())" |
|
672 | $ fileset "status('2', ' ', added())" | |
671 | hg: parse error at 1: not a prefix: end |
|
673 | hg: parse error at 1: not a prefix: end | |
|
674 | ( | |||
|
675 | ^ here) | |||
672 | [255] |
|
676 | [255] |
@@ -399,6 +399,8 b' quoting needed' | |||||
399 | 4 |
|
399 | 4 | |
400 | $ log 'date(this is a test)' |
|
400 | $ log 'date(this is a test)' | |
401 | hg: parse error at 10: unexpected token: symbol |
|
401 | hg: parse error at 10: unexpected token: symbol | |
|
402 | (date(this is a test) | |||
|
403 | ^ here) | |||
402 | [255] |
|
404 | [255] | |
403 | $ log 'date()' |
|
405 | $ log 'date()' | |
404 | hg: parse error: date requires a string |
|
406 | hg: parse error: date requires a string | |
@@ -408,6 +410,8 b' quoting needed' | |||||
408 | [255] |
|
410 | [255] | |
409 | $ log 'date(' |
|
411 | $ log 'date(' | |
410 | hg: parse error at 5: not a prefix: end |
|
412 | hg: parse error at 5: not a prefix: end | |
|
413 | (date( | |||
|
414 | ^ here) | |||
411 | [255] |
|
415 | [255] | |
412 | $ log 'date("\xy")' |
|
416 | $ log 'date("\xy")' | |
413 | hg: parse error: invalid \x escape* (glob) |
|
417 | hg: parse error: invalid \x escape* (glob) | |
@@ -614,18 +618,28 b' parse errors of relation, subscript and ' | |||||
614 |
|
618 | |||
615 | $ hg debugrevspec '[0]' |
|
619 | $ hg debugrevspec '[0]' | |
616 | hg: parse error at 0: not a prefix: [ |
|
620 | hg: parse error at 0: not a prefix: [ | |
|
621 | ([0] | |||
|
622 | ^ here) | |||
617 | [255] |
|
623 | [255] | |
618 | $ hg debugrevspec '.#' |
|
624 | $ hg debugrevspec '.#' | |
619 | hg: parse error at 2: not a prefix: end |
|
625 | hg: parse error at 2: not a prefix: end | |
|
626 | (.# | |||
|
627 | ^ here) | |||
620 | [255] |
|
628 | [255] | |
621 | $ hg debugrevspec '#rel' |
|
629 | $ hg debugrevspec '#rel' | |
622 | hg: parse error at 0: not a prefix: # |
|
630 | hg: parse error at 0: not a prefix: # | |
|
631 | (#rel | |||
|
632 | ^ here) | |||
623 | [255] |
|
633 | [255] | |
624 | $ hg debugrevspec '.#rel[0' |
|
634 | $ hg debugrevspec '.#rel[0' | |
625 | hg: parse error at 7: unexpected token: end |
|
635 | hg: parse error at 7: unexpected token: end | |
|
636 | (.#rel[0 | |||
|
637 | ^ here) | |||
626 | [255] |
|
638 | [255] | |
627 | $ hg debugrevspec '.]' |
|
639 | $ hg debugrevspec '.]' | |
628 | hg: parse error at 1: invalid token |
|
640 | hg: parse error at 1: invalid token | |
|
641 | (.] | |||
|
642 | ^ here) | |||
629 | [255] |
|
643 | [255] | |
630 |
|
644 | |||
631 | $ hg debugrevspec '.#generations[a]' |
|
645 | $ hg debugrevspec '.#generations[a]' | |
@@ -1330,6 +1344,8 b' test author' | |||||
1330 | 6 |
|
1344 | 6 | |
1331 | $ try 'grep(r"\")' |
|
1345 | $ try 'grep(r"\")' | |
1332 | hg: parse error at 7: unterminated string |
|
1346 | hg: parse error at 7: unterminated string | |
|
1347 | (grep(r"\") | |||
|
1348 | ^ here) | |||
1333 | [255] |
|
1349 | [255] | |
1334 | $ log 'head()' |
|
1350 | $ log 'head()' | |
1335 | 0 |
|
1351 | 0 | |
@@ -2774,3 +2790,14 b' topo.firstbranch should accept any kind ' | |||||
2774 |
|
2790 | |||
2775 | $ cd .. |
|
2791 | $ cd .. | |
2776 | $ cd repo |
|
2792 | $ cd repo | |
|
2793 | ||||
|
2794 | test multiline revset with errors | |||
|
2795 | ||||
|
2796 | $ echo > multiline-revset | |||
|
2797 | $ echo '. +' >> multiline-revset | |||
|
2798 | $ echo '.^ +' >> multiline-revset | |||
|
2799 | $ hg log -r "`cat multiline-revset`" | |||
|
2800 | hg: parse error at 9: not a prefix: end | |||
|
2801 | ( . + .^ + | |||
|
2802 | ^ here) | |||
|
2803 | [255] |
@@ -690,6 +690,8 b' issue2654: report a parse error if the r' | |||||
690 |
|
690 | |||
691 | $ log '1 OR 2' |
|
691 | $ log '1 OR 2' | |
692 | hg: parse error at 2: invalid token |
|
692 | hg: parse error at 2: invalid token | |
|
693 | (1 OR 2 | |||
|
694 | ^ here) | |||
693 | [255] |
|
695 | [255] | |
694 |
|
696 | |||
695 | or operator should preserve ordering: |
|
697 | or operator should preserve ordering: | |
@@ -1562,6 +1564,8 b' test in problematic encoding' | |||||
1562 | test error message of bad revset |
|
1564 | test error message of bad revset | |
1563 | $ hg log -r 'foo\\' |
|
1565 | $ hg log -r 'foo\\' | |
1564 | hg: parse error at 3: syntax error in revset 'foo\\' |
|
1566 | hg: parse error at 3: syntax error in revset 'foo\\' | |
|
1567 | (foo\\ | |||
|
1568 | ^ here) | |||
1565 | [255] |
|
1569 | [255] | |
1566 |
|
1570 | |||
1567 | $ cd .. |
|
1571 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now