Mercurial > hg
comparison tests/test-revset2.t @ 45895:fc4fb2f17dd4
errors: use exit code 10 for parse errors
Now that `ParseError`s raised while reading the config file has been
converted into `ConfigError`s, the remaining parse errors should all
be "input errors" (i.e. exit code 10), according to
https://www.mercurial-scm.org/wiki/ErrorCategoriesPlan.
Differential Revision: https://phab.mercurial-scm.org/D9332
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 16 Nov 2020 16:00:50 -0800 |
parents | 99ebde4fec99 |
children | 95c4cca641f6 |
comparison
equal
deleted
inserted
replaced
45894:9dc1351d0b5f | 45895:fc4fb2f17dd4 |
---|---|
344 | 344 |
345 test ',' in `_list` | 345 test ',' in `_list` |
346 $ log '0,1' | 346 $ log '0,1' |
347 hg: parse error: can't use a list in this context | 347 hg: parse error: can't use a list in this context |
348 (see 'hg help "revsets.x or y"') | 348 (see 'hg help "revsets.x or y"') |
349 [255] | 349 [10] |
350 $ try '0,1,2' | 350 $ try '0,1,2' |
351 (list | 351 (list |
352 (symbol '0') | 352 (symbol '0') |
353 (symbol '1') | 353 (symbol '1') |
354 (symbol '2')) | 354 (symbol '2')) |
355 hg: parse error: can't use a list in this context | 355 hg: parse error: can't use a list in this context |
356 (see 'hg help "revsets.x or y"') | 356 (see 'hg help "revsets.x or y"') |
357 [255] | 357 [10] |
358 | 358 |
359 test that chained `or` operations make balanced addsets | 359 test that chained `or` operations make balanced addsets |
360 | 360 |
361 $ try '0:1|1:2|2:3|3:4|4:5' | 361 $ try '0:1|1:2|2:3|3:4|4:5' |
362 (or | 362 (or |
405 (or | 405 (or |
406 (list | 406 (list |
407 (symbol '0') | 407 (symbol '0') |
408 None)) | 408 None)) |
409 hg: parse error: missing argument | 409 hg: parse error: missing argument |
410 [255] | 410 [10] |
411 | 411 |
412 test that chained `or` operations never eat up stack (issue4624) | 412 test that chained `or` operations never eat up stack (issue4624) |
413 (uses `0:1` instead of `0` to avoid future optimization of trivial revisions) | 413 (uses `0:1` instead of `0` to avoid future optimization of trivial revisions) |
414 | 414 |
415 $ hg log -T '{rev}\n' -r `"$PYTHON" -c "print('+'.join(['0:1'] * 500))"` | 415 $ hg log -T '{rev}\n' -r `"$PYTHON" -c "print('+'.join(['0:1'] * 500))"` |
508 (func | 508 (func |
509 (symbol 'ancestors') | 509 (symbol 'ancestors') |
510 (symbol '1')) | 510 (symbol '1')) |
511 None) | 511 None) |
512 hg: parse error: missing argument | 512 hg: parse error: missing argument |
513 [255] | 513 [10] |
514 | 514 |
515 optimization to only() works only if ancestors() takes only one argument | 515 optimization to only() works only if ancestors() takes only one argument |
516 | 516 |
517 $ hg debugrevspec -p optimized 'ancestors(6) - ancestors(4, 1)' | 517 $ hg debugrevspec -p optimized 'ancestors(6) - ancestors(4, 1)' |
518 * optimized: | 518 * optimized: |
566 | 566 |
567 invalid function call should not be optimized to only() | 567 invalid function call should not be optimized to only() |
568 | 568 |
569 $ log '"ancestors"(6) and not ancestors(4)' | 569 $ log '"ancestors"(6) and not ancestors(4)' |
570 hg: parse error: not a symbol | 570 hg: parse error: not a symbol |
571 [255] | 571 [10] |
572 | 572 |
573 $ log 'ancestors(6) and not "ancestors"(4)' | 573 $ log 'ancestors(6) and not "ancestors"(4)' |
574 hg: parse error: not a symbol | 574 hg: parse error: not a symbol |
575 [255] | 575 [10] |
576 | 576 |
577 test empty string | 577 test empty string |
578 | 578 |
579 $ log '' | 579 $ log '' |
580 hg: parse error: empty query | 580 hg: parse error: empty query |
581 [255] | 581 [10] |
582 $ log 'parents("")' | 582 $ log 'parents("")' |
583 hg: parse error: empty string is not a valid revision | 583 hg: parse error: empty string is not a valid revision |
584 [255] | 584 [10] |
585 | 585 |
586 test empty revset | 586 test empty revset |
587 $ hg log 'none()' | 587 $ hg log 'none()' |
588 | 588 |
589 we can use patterns when searching for tags | 589 we can use patterns when searching for tags |
699 | 699 |
700 $ log '1 OR 2' | 700 $ log '1 OR 2' |
701 hg: parse error at 2: invalid token | 701 hg: parse error at 2: invalid token |
702 (1 OR 2 | 702 (1 OR 2 |
703 ^ here) | 703 ^ here) |
704 [255] | 704 [10] |
705 | 705 |
706 or operator should preserve ordering: | 706 or operator should preserve ordering: |
707 $ log 'reverse(2::4) or tip' | 707 $ log 'reverse(2::4) or tip' |
708 4 | 708 4 |
709 2 | 709 2 |
753 6 | 753 6 |
754 8 | 754 8 |
755 | 755 |
756 $ log 'tip^foo' | 756 $ log 'tip^foo' |
757 hg: parse error: ^ expects a number 0, 1, or 2 | 757 hg: parse error: ^ expects a number 0, 1, or 2 |
758 [255] | 758 [10] |
759 | 759 |
760 $ log 'branchpoint()~-1' | 760 $ log 'branchpoint()~-1' |
761 abort: revision in set has more than one child! | 761 abort: revision in set has more than one child! |
762 [255] | 762 [255] |
763 | 763 |
764 Bogus function gets suggestions | 764 Bogus function gets suggestions |
765 $ log 'add()' | 765 $ log 'add()' |
766 hg: parse error: unknown identifier: add | 766 hg: parse error: unknown identifier: add |
767 (did you mean adds?) | 767 (did you mean adds?) |
768 [255] | 768 [10] |
769 $ log 'added()' | 769 $ log 'added()' |
770 hg: parse error: unknown identifier: added | 770 hg: parse error: unknown identifier: added |
771 (did you mean adds?) | 771 (did you mean adds?) |
772 [255] | 772 [10] |
773 $ log 'remo()' | 773 $ log 'remo()' |
774 hg: parse error: unknown identifier: remo | 774 hg: parse error: unknown identifier: remo |
775 (did you mean one of remote, removes?) | 775 (did you mean one of remote, removes?) |
776 [255] | 776 [10] |
777 $ log 'babar()' | 777 $ log 'babar()' |
778 hg: parse error: unknown identifier: babar | 778 hg: parse error: unknown identifier: babar |
779 [255] | 779 [10] |
780 | 780 |
781 Bogus function with a similar internal name doesn't suggest the internal name | 781 Bogus function with a similar internal name doesn't suggest the internal name |
782 $ log 'matches()' | 782 $ log 'matches()' |
783 hg: parse error: unknown identifier: matches | 783 hg: parse error: unknown identifier: matches |
784 (did you mean matching?) | 784 (did you mean matching?) |
785 [255] | 785 [10] |
786 | 786 |
787 Undocumented functions aren't suggested as similar either | 787 Undocumented functions aren't suggested as similar either |
788 $ log 'tagged2()' | 788 $ log 'tagged2()' |
789 hg: parse error: unknown identifier: tagged2 | 789 hg: parse error: unknown identifier: tagged2 |
790 [255] | 790 [10] |
791 | 791 |
792 multiple revspecs | 792 multiple revspecs |
793 | 793 |
794 $ hg log -r 'tip~1:tip' -r 'tip~2:tip~1' --template '{rev}\n' | 794 $ hg log -r 'tip~1:tip' -r 'tip~2:tip~1' --template '{rev}\n' |
795 8 | 795 8 |
947 $ echo 'recurse1 = recurse2' >> .hg/hgrc | 947 $ echo 'recurse1 = recurse2' >> .hg/hgrc |
948 $ echo 'recurse2 = recurse1' >> .hg/hgrc | 948 $ echo 'recurse2 = recurse1' >> .hg/hgrc |
949 $ try recurse1 | 949 $ try recurse1 |
950 (symbol 'recurse1') | 950 (symbol 'recurse1') |
951 hg: parse error: infinite expansion of revset alias "recurse1" detected | 951 hg: parse error: infinite expansion of revset alias "recurse1" detected |
952 [255] | 952 [10] |
953 | 953 |
954 $ echo 'level1($1, $2) = $1 or $2' >> .hg/hgrc | 954 $ echo 'level1($1, $2) = $1 or $2' >> .hg/hgrc |
955 $ echo 'level2($1, $2) = level1($2, $1)' >> .hg/hgrc | 955 $ echo 'level2($1, $2) = level1($2, $1)' >> .hg/hgrc |
956 $ try "level2(level1(1, 2), 3)" | 956 $ try "level2(level1(1, 2), 3)" |
957 (func | 957 (func |
1183 $ try 'rs()' | 1183 $ try 'rs()' |
1184 (func | 1184 (func |
1185 (symbol 'rs') | 1185 (symbol 'rs') |
1186 None) | 1186 None) |
1187 hg: parse error: invalid number of arguments: 0 | 1187 hg: parse error: invalid number of arguments: 0 |
1188 [255] | 1188 [10] |
1189 $ try 'rs(2)' | 1189 $ try 'rs(2)' |
1190 (func | 1190 (func |
1191 (symbol 'rs') | 1191 (symbol 'rs') |
1192 (symbol '2')) | 1192 (symbol '2')) |
1193 hg: parse error: invalid number of arguments: 1 | 1193 hg: parse error: invalid number of arguments: 1 |
1194 [255] | 1194 [10] |
1195 $ try 'rs(2, data, 7)' | 1195 $ try 'rs(2, data, 7)' |
1196 (func | 1196 (func |
1197 (symbol 'rs') | 1197 (symbol 'rs') |
1198 (list | 1198 (list |
1199 (symbol '2') | 1199 (symbol '2') |
1200 (symbol 'data') | 1200 (symbol 'data') |
1201 (symbol '7'))) | 1201 (symbol '7'))) |
1202 hg: parse error: invalid number of arguments: 3 | 1202 hg: parse error: invalid number of arguments: 3 |
1203 [255] | 1203 [10] |
1204 $ try 'rs4(2 or 3, x, x, date)' | 1204 $ try 'rs4(2 or 3, x, x, date)' |
1205 (func | 1205 (func |
1206 (symbol 'rs4') | 1206 (symbol 'rs4') |
1207 (list | 1207 (list |
1208 (or | 1208 (or |
1573 test error message of bad revset | 1573 test error message of bad revset |
1574 $ hg log -r 'foo\\' | 1574 $ hg log -r 'foo\\' |
1575 hg: parse error at 3: syntax error in revset 'foo\\' | 1575 hg: parse error at 3: syntax error in revset 'foo\\' |
1576 (foo\\ | 1576 (foo\\ |
1577 ^ here) | 1577 ^ here) |
1578 [255] | 1578 [10] |
1579 | 1579 |
1580 $ cd .. | 1580 $ cd .. |
1581 | 1581 |
1582 Test that revset predicate of extension isn't loaded at failure of | 1582 Test that revset predicate of extension isn't loaded at failure of |
1583 loading it | 1583 loading it |
1601 > EOF | 1601 > EOF |
1602 | 1602 |
1603 $ hg debugrevspec "custom1()" | 1603 $ hg debugrevspec "custom1()" |
1604 *** failed to import extension custompredicate from $TESTTMP/custompredicate.py: intentional failure of loading extension | 1604 *** failed to import extension custompredicate from $TESTTMP/custompredicate.py: intentional failure of loading extension |
1605 hg: parse error: unknown identifier: custom1 | 1605 hg: parse error: unknown identifier: custom1 |
1606 [255] | 1606 [10] |
1607 | 1607 |
1608 Test repo.anyrevs with customized revset overrides | 1608 Test repo.anyrevs with customized revset overrides |
1609 | 1609 |
1610 $ cat > $TESTTMP/printprevset.py <<EOF | 1610 $ cat > $TESTTMP/printprevset.py <<EOF |
1611 > from mercurial import encoding, registrar | 1611 > from mercurial import encoding, registrar |