38
38
""" Display Commit dialog and perform the needed actions. """
39
def __init__(self, gladefile, comm, dialog):
39
def __init__(self, gladefile, wt, wtpath, dialog):
40
40
""" Initialize the Commit dialog. """
41
41
self.gladefile = gladefile
42
42
self.glade = gtk.glade.XML(self.gladefile, 'window_commit', 'olive-gtk')
44
# Communication object
47
48
self.dialog = dialog
52
53
self.textview = self.glade.get_widget('textview_commit')
53
54
self.file_view = self.glade.get_widget('treeview_commit_select')
55
# Check if current location is a branch
57
(self.wt, path) = WorkingTree.open_containing(self.comm.get_path())
58
branch = self.wt.branch
59
except errors.NotBranchError:
65
file_id = self.wt.path2id(path)
56
file_id = self.wt.path2id(wtpath)
67
58
self.notbranch = False
68
59
if file_id is None:
93
84
_('You can perform this action only in a branch.'))
96
from bzrlib.branch import Branch
97
branch = Branch.open_containing(self.comm.get_path())[0]
99
if branch.get_bound_location() is not None:
87
if self.wt.branch.get_bound_location() is not None:
100
88
# we have a checkout, so the local commit checkbox must appear
101
89
self.checkbutton_local.show()
158
145
specific_files = self._get_specific_files()
160
self.comm.set_busy(self.window)
161
# merged from Jelmer Vernooij's olive integration branch
163
148
self.wt.commit(message,
164
149
allow_pointless=checkbutton_force.get_active(),
168
153
except errors.NotBranchError:
169
154
self.dialog.error_dialog(_('Directory is not a branch'),
170
155
_('You can perform this action only in a branch.'))
171
self.comm.set_busy(self.window, False)
173
157
except errors.LocalRequiresBoundBranch:
174
158
self.dialog.error_dialog(_('Directory is not a checkout'),
175
159
_('You can perform local commit only on checkouts.'))
176
self.comm.set_busy(self.window, False)
178
161
except errors.PointlessCommit:
179
162
self.dialog.error_dialog(_('No changes to commit'),
180
163
_('Try force commit if you want to commit anyway.'))
181
self.comm.set_busy(self.window, False)
183
165
except errors.ConflictsInTree:
184
166
self.dialog.error_dialog(_('Conflicts in tree'),
185
167
_('You need to resolve the conflicts before committing.'))
186
self.comm.set_busy(self.window, False)
188
169
except errors.StrictCommitFailed:
189
170
self.dialog.error_dialog(_('Strict commit failed'),
190
171
_('There are unknown files in the working tree.\nPlease add or delete them.'))
191
self.comm.set_busy(self.window, False)
193
173
except errors.BoundBranchOutOfDate, errmsg:
194
174
self.dialog.error_dialog(_('Bound branch is out of date'),
195
175
_('%s') % errmsg)
196
self.comm.set_busy(self.window, False)