38
38
""" Display Commit dialog and perform the needed actions. """
39
39
def __init__(self, gladefile, comm):
40
40
""" Initialize the Commit dialog. """
41
43
self.gladefile = gladefile
42
44
self.glade = gtk.glade.XML(self.gladefile, 'window_commit')
66
68
self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
67
self.delta = compare_trees(self.old_tree, self.wt)
69
if bzrlib.version_info[1] < 9:
70
self.delta = compare_trees(self.old_tree, self.wt)
72
self.delta = self.wt.changes_from(self.old_tree)
69
74
# Get the Commit dialog widget
70
75
self.window = self.glade.get_widget('window_commit')
79
84
# Create the file list
80
85
self._create_file_view()
87
# Some additional widgets
88
self.checkbutton_local = self.glade.get_widget('checkbutton_commit_local')
83
91
""" Display the Push dialog. """
85
93
self.dialog.error_dialog('Directory is not a branch.')
87
self.window.show_all()
95
from olive.backend.info import is_checkout
96
if is_checkout(self.comm.get_path()):
97
# we have a checkout, so the local commit checkbox must appear
98
self.checkbutton_local.show()
89
103
# This code is from Jelmer Vernooij's bzr-gtk branch
90
104
def _create_file_view(self):
136
150
start, end = textbuffer.get_bounds()
137
151
message = textbuffer.get_text(start, end)
139
checkbutton_local = self.glade.get_widget('checkbutton_commit_local')
140
153
checkbutton_strict = self.glade.get_widget('checkbutton_commit_strict')
141
154
checkbutton_force = self.glade.get_widget('checkbutton_commit_force')
143
156
specific_files = self._get_specific_files()
158
self.comm.set_busy(self.window)
145
159
# merged from Jelmer Vernooij's olive integration branch
147
161
self.wt.commit(message,
148
162
allow_pointless=checkbutton_force.get_active(),
149
163
strict=checkbutton_strict.get_active(),
150
local=checkbutton_local.get_active(),
164
local=self.checkbutton_local.get_active(),
151
165
specific_files=specific_files)
152
166
except errors.NotBranchError:
153
167
self.dialog.error_dialog('Directory is not a branch.')
168
self.comm.set_busy(self.window, False)
155
170
except errors.LocalRequiresBoundBranch:
156
171
self.dialog.error_dialog('Local commit requires a bound branch.')
172
self.comm.set_busy(self.window, False)
158
174
except errors.PointlessCommit:
159
175
self.dialog.error_dialog('No changes to commit. Try force commit.')
176
self.comm.set_busy(self.window, False)
161
178
except errors.ConflictsInTree:
162
179
self.dialog.error_dialog('Conflicts in tree. Please resolve them first.')
180
self.comm.set_busy(self.window, False)
164
182
except errors.StrictCommitFailed:
165
183
self.dialog.error_dialog('Strict commit failed. There are unknown files.')
184
self.comm.set_busy(self.window, False)
167
186
except errors.BoundBranchOutOfDate, errmsg:
168
187
self.dialog.error_dialog('Bound branch is out of date: %s' % errmsg)
188
self.comm.set_busy(self.window, False)