6
6
def __init__(self, patches):
7
7
self.standard_options = [
8
UserOption('n', self.shelve, 'shelve this change for the moment.',
10
UserOption('y', self.keep, 'keep this change in your tree.'),
8
UserOption('y', self.shelve, 'shelve this change.', default=True),
9
UserOption('n', self.keep, 'keep this change in your tree.'),
11
10
UserOption('d', UserInteractor.FINISH, 'done, skip to the end.'),
12
11
UserOption('i', self.invert,
13
'invert the current selection of all hunks.'),
14
UserOption('s', self.status, 'show status of hunks.'),
12
'invert the current selection status of all hunks.'),
13
UserOption('s', self.status, 'show selection status of all hunks.'),
15
14
UserOption('q', UserInteractor.QUIT, 'quit')
18
17
self.end_options = [
19
18
UserOption('y', UserInteractor.FINISH,
20
'proceed to shelve selected changes.', default=True),
19
'shelve selected changes.', default=True),
21
20
UserOption('r', UserInteractor.RESTART,
22
21
'restart the hunk selection loop.'),
23
UserOption('s', self.status, 'show status of hunks.'),
22
UserOption('s', self.status, 'show selection status of all hunks.'),
24
23
UserOption('i', self.invert,
25
'invert the current selection of all hunks.'),
24
'invert the current selection status of all hunks.'),
26
25
UserOption('q', UserInteractor.QUIT, 'quit')
48
46
# Called at the start of the main loop
49
47
def start_callback(self):
48
self.interactor.set_prompt('Shelve this change? ' \
49
'(%(count)d of %(total)d)')
50
50
self.interactor.set_options(self.standard_options)
52
52
# Called at the end of the item loop, return False to indicate that the
53
53
# interaction isn't finished and the confirmation prompt should be displayed
54
54
def end_callback(self):
56
self.interactor.set_prompt("Shelve these changes, or restart?")
56
self.interactor.set_prompt("Shelve these changes?")
57
57
self.interactor.set_options(self.end_options)
64
64
self.last_printed = count
67
self.interactor.get_option('y').default = True
68
self.interactor.get_option('n').default = False
70
self.interactor.get_option('y').default = False
67
71
self.interactor.get_option('n').default = True
68
self.interactor.get_option('y').default = False
70
self.interactor.get_option('n').default = False
71
self.interactor.get_option('y').default = True
73
73
# The user chooses to shelve a hunk
74
74
def shelve(self, hunk):