comparison tests/test-revset2.t @ 48116:5ced12cfa41b

errors: raise InputError on bad revset to revrange() iff provided by the user Most callers of `scmutil.revrange()` pass in a revset provided by the user. If there are problems resolving that, it should result in an `InputError` and exit code 10 (when using detailed exit codes). However, there are also some callers that pass in revsets not provided by the user. `InputError` is not appropriate in those cases. This patch therefore introduces a wrapper around `scmutil.revrange()` that simply converts the exception type. I put it in `logcmdutil.py` since that seems to be the lowest-level module in the (poorly defined) UI layer. Differential Revision: https://phab.mercurial-scm.org/D11560
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 28 Sep 2021 08:47:11 -0700
parents 7d908ee19b5b
children e4acdf5d94a2
comparison
equal deleted inserted replaced
48115:b067d22dc6ad 48116:5ced12cfa41b
318 318
319 test unknown revision in `_list` 319 test unknown revision in `_list`
320 320
321 $ log '0|unknown' 321 $ log '0|unknown'
322 abort: unknown revision 'unknown' 322 abort: unknown revision 'unknown'
323 [255] 323 [10]
324 324
325 test integer range in `_list` 325 test integer range in `_list`
326 326
327 $ log '-1|-10' 327 $ log '-1|-10'
328 9 328 9
329 0 329 0
330 330
331 $ log '-10|-11' 331 $ log '-10|-11'
332 abort: unknown revision '-11' 332 abort: unknown revision '-11'
333 [255] 333 [10]
334 334
335 $ log '9|10' 335 $ log '9|10'
336 abort: unknown revision '10' 336 abort: unknown revision '10'
337 [255] 337 [10]
338 338
339 test '0000' != '0' in `_list` 339 test '0000' != '0' in `_list`
340 340
341 $ log '0|0000' 341 $ log '0|0000'
342 0 342 0
588 588
589 we can use patterns when searching for tags 589 we can use patterns when searching for tags
590 590
591 $ log 'tag("1..*")' 591 $ log 'tag("1..*")'
592 abort: tag '1..*' does not exist 592 abort: tag '1..*' does not exist
593 [255] 593 [10]
594 $ log 'tag("re:1..*")' 594 $ log 'tag("re:1..*")'
595 6 595 6
596 $ log 'tag("re:[0-9].[0-9]")' 596 $ log 'tag("re:[0-9].[0-9]")'
597 6 597 6
598 $ log 'tag("literal:1.0")' 598 $ log 'tag("literal:1.0")'
599 6 599 6
600 $ log 'tag("re:0..*")' 600 $ log 'tag("re:0..*")'
601 601
602 $ log 'tag(unknown)' 602 $ log 'tag(unknown)'
603 abort: tag 'unknown' does not exist 603 abort: tag 'unknown' does not exist
604 [255] 604 [10]
605 $ log 'tag("re:unknown")' 605 $ log 'tag("re:unknown")'
606 $ log 'present(tag("unknown"))' 606 $ log 'present(tag("unknown"))'
607 $ log 'present(tag("re:unknown"))' 607 $ log 'present(tag("re:unknown"))'
608 $ log 'branch(unknown)' 608 $ log 'branch(unknown)'
609 abort: unknown revision 'unknown' 609 abort: unknown revision 'unknown'
610 [255] 610 [10]
611 $ log 'branch("literal:unknown")' 611 $ log 'branch("literal:unknown")'
612 abort: branch 'unknown' does not exist 612 abort: branch 'unknown' does not exist
613 [255] 613 [10]
614 $ log 'branch("re:unknown")' 614 $ log 'branch("re:unknown")'
615 $ log 'present(branch("unknown"))' 615 $ log 'present(branch("unknown"))'
616 $ log 'present(branch("re:unknown"))' 616 $ log 'present(branch("re:unknown"))'
617 $ log 'user(bob)' 617 $ log 'user(bob)'
618 2 618 2
664 3 664 3
665 1 665 1
666 666
667 $ log 'named("unknown")' 667 $ log 'named("unknown")'
668 abort: namespace 'unknown' does not exist 668 abort: namespace 'unknown' does not exist
669 [255] 669 [10]
670 $ log 'named("re:unknown")' 670 $ log 'named("re:unknown")'
671 $ log 'present(named("unknown"))' 671 $ log 'present(named("unknown"))'
672 $ log 'present(named("re:unknown"))' 672 $ log 'present(named("re:unknown"))'
673 673
674 $ log 'tag()' 674 $ log 'tag()'
757 hg: parse error: ^ expects a number 0, 1, or 2 757 hg: parse error: ^ expects a number 0, 1, or 2
758 [10] 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 [10]
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?)