##// END OF EJS Templates
bisect: improve option validation message
Brandon McCaig -
r32766:fbe9c4dc default
parent child Browse files
Show More
@@ -9,6 +9,7 b' from __future__ import absolute_import'
9
9
10 import difflib
10 import difflib
11 import errno
11 import errno
12 import itertools
12 import os
13 import os
13 import re
14 import re
14 import sys
15 import sys
@@ -768,9 +769,22 b' def bisect(ui, repo, rev=None, extra=Non'
768 bad = True
769 bad = True
769 else:
770 else:
770 reset = True
771 reset = True
771 elif extra or good + bad + skip + reset + extend + bool(command) > 1:
772 elif extra:
772 raise error.Abort(_('incompatible arguments'))
773 raise error.Abort(_('incompatible arguments'))
773
774
775 incompatibles = {
776 '--bad': bad,
777 '--command': bool(command),
778 '--extend': extend,
779 '--good': good,
780 '--reset': reset,
781 '--skip': skip,
782 }
783
784 for left, right in itertools.combinations(sorted(incompatibles), 2):
785 if incompatibles[left] and incompatibles[right]:
786 raise error.Abort(_('%s and %s are incompatible') % (left, right))
787
774 if reset:
788 if reset:
775 hbisect.resetstate(repo)
789 hbisect.resetstate(repo)
776 return
790 return
@@ -611,3 +611,51 b' Changeset in the bad:good range is obsol'
611 date: Thu Jan 01 00:00:26 1970 +0000
611 date: Thu Jan 01 00:00:26 1970 +0000
612 summary: msg 26
612 summary: msg 26
613
613
614 Test the validation message when exclusive options are used:
615
616 $ hg bisect -r
617 $ hg bisect -b -c false
618 abort: --bad and --command are incompatible
619 [255]
620 $ hg bisect -b -e
621 abort: --bad and --extend are incompatible
622 [255]
623 $ hg bisect -b -g
624 abort: --bad and --good are incompatible
625 [255]
626 $ hg bisect -b -r
627 abort: --bad and --reset are incompatible
628 [255]
629 $ hg bisect -b -s
630 abort: --bad and --skip are incompatible
631 [255]
632 $ hg bisect -c false -e
633 abort: --command and --extend are incompatible
634 [255]
635 $ hg bisect -c false -g
636 abort: --command and --good are incompatible
637 [255]
638 $ hg bisect -c false -r
639 abort: --command and --reset are incompatible
640 [255]
641 $ hg bisect -c false -s
642 abort: --command and --skip are incompatible
643 [255]
644 $ hg bisect -e -g
645 abort: --extend and --good are incompatible
646 [255]
647 $ hg bisect -e -r
648 abort: --extend and --reset are incompatible
649 [255]
650 $ hg bisect -e -s
651 abort: --extend and --skip are incompatible
652 [255]
653 $ hg bisect -g -r
654 abort: --good and --reset are incompatible
655 [255]
656 $ hg bisect -g -s
657 abort: --good and --skip are incompatible
658 [255]
659 $ hg bisect -r -s
660 abort: --reset and --skip are incompatible
661 [255]
General Comments 0
You need to be logged in to leave comments. Login now