/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bisect.py

Set up the subcommand dispatcher.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from bzrlib.commands import Command, register_command
 
2
from errors import CommandError
2
3
 
3
4
class cmd_bisect(Command):
4
5
    """Find an interesting commit using a binary search.
35
36
    bzr bisect replay <logfile>
36
37
        Replay a previously-saved bisect log, forgetting any bisection
37
38
        that might be in progress.
38
 
"""
 
39
    """
 
40
 
 
41
    takes_args = ['subcommand', 'args*']
 
42
 
 
43
    def run(self, subcommand, args_list):
 
44
        # Handle subcommand parameters.
 
45
 
 
46
        revision = None
 
47
        log_fn = None
 
48
        if subcommand in ('yes', 'no') and len(args_list) == 2:
 
49
            if args_list[0] == "-r":
 
50
                revision = args_list[1]
 
51
            else:
 
52
                raise CommandError("Improper arguments to bisect " + subcommand)
 
53
        elif subcommand in ('replay',) and len(args_list) == 1:
 
54
            log_fn = args_list[0]
 
55
        elif args_list:
 
56
            raise CommandError("Improper arguments to bisect " + subcommand)
 
57
 
 
58
        # Dispatch.
 
59
 
 
60
        if subcommand == "start":
 
61
            self.start()
 
62
        elif subcommand == "yes":
 
63
            self.yes(revision)
 
64
        elif subcommand == "no":
 
65
            self.no(revision)
 
66
        elif subcommand == "reset":
 
67
            self.reset()
 
68
        elif subcommand == "log":
 
69
            self.log(None)
 
70
        elif subcommand == "replay":
 
71
            self.replay(log_fn)
 
72
 
 
73
    def reset(self):
 
74
        "Reset the bisect state to no state."
 
75
        pass
 
76
 
 
77
    def start(self):
 
78
        "Reset the bisect state, then prepare for a new bisection."
 
79
        pass
 
80
 
 
81
    def yes(self, revision):
 
82
        "Mark that a given revision has the state we're looking for."
 
83
        pass
 
84
 
 
85
    def no(self, revision):
 
86
        "Mark that a given revision does not have the state we're looking for."
 
87
        pass
 
88
 
 
89
    def log(self, filename):
 
90
        "Write the current bisect log to a file."
 
91
        pass
 
92
 
 
93
    def replay(self, filename):
 
94
        """Apply the given log file to a clean state, so the state is
 
95
        exactly as it was when the log was saved."""
 
96
        pass
39
97
 
40
98
register_command(cmd_bisect)