46
self.dialog = OliveDialog(self.gladefile)
48
# Check if current location is a branch
50
(self.wt, path) = WorkingTree.open_containing(self.comm.get_path())
51
branch = self.wt.branch
52
except errors.NotBranchError:
58
file_id = self.wt.path2id(path)
60
self.notbranch = False
66
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
# Get the Commit dialog widget
42
70
self.window = self.glade.get_widget('window_commit')
44
72
# Dictionary for signal_autoconnect
48
76
# Connect the signals to the handlers
49
77
self.glade.signal_autoconnect(dic)
79
# Create the file list
80
self._create_file_view()
52
83
""" Display the Push dialog. """
53
self.window.show_all()
85
self.dialog.error_dialog('Directory is not a branch.')
87
self.window.show_all()
89
# This code is from Jelmer Vernooij's bzr-gtk branch
90
def _create_file_view(self):
91
self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING)
92
self.file_view = self.glade.get_widget('treeview_commit_select')
93
self.file_view.set_model(self.file_store)
94
crt = gtk.CellRendererToggle()
95
crt.set_property("activatable", True)
96
crt.connect("toggled", self._toggle_commit, self.file_store)
97
self.file_view.append_column(gtk.TreeViewColumn("Commit",crt,active=0))
98
self.file_view.append_column(gtk.TreeViewColumn("Path",gtk.CellRendererText(),text=1))
99
self.file_view.append_column(gtk.TreeViewColumn("Type",gtk.CellRendererText(),text=2))
101
for path, id, kind in self.delta.added:
102
self.file_store.append([ True, path, "added" ])
104
for path, id, kind in self.delta.removed:
105
self.file_store.append([ True, path, "removed" ])
107
for oldpath, newpath, id, kind, text_modified, meta_modified in self.delta.renamed:
108
self.file_store.append([ True, oldpath, "renamed"])
110
for path, id, kind, text_modified, meta_modified in self.delta.modified:
111
self.file_store.append([ True, path, "modified"])
113
def _get_specific_files(self):
115
it = self.file_store.get_iter_first()
117
if self.file_store.get_value(it, 0):
118
ret.append(self.file_store.get_value(it,1))
119
it = self.file_store.iter_next(it)
122
# end of bzr-gtk code
124
def _toggle_commit(self, cell, path, model):
125
model[path][0] = not model[path][0]
55
128
def commit(self, widget):
56
from dialog import OliveDialog
57
dialog = OliveDialog(self.gladefile)
59
129
textview = self.glade.get_widget('textview_commit')
60
130
textbuffer = textview.get_buffer()
61
131
start, end = textbuffer.get_bounds()
65
135
checkbutton_strict = self.glade.get_widget('checkbutton_commit_strict')
66
136
checkbutton_force = self.glade.get_widget('checkbutton_commit_force')
138
specific_files = self._get_specific_files()
140
# merged from Jelmer Vernooij's olive integration branch
69
commit.commit([self.comm.get_path()], message, None,
70
checkbutton_force.get_active(),
71
checkbutton_strict.get_active(),
72
checkbutton_local.get_active())
142
self.wt.commit(message,
143
allow_pointless=checkbutton_force.get_active(),
144
strict=checkbutton_strict.get_active(),
145
local=checkbutton_local.get_active(),
146
specific_files=specific_files)
73
147
except errors.NotBranchError:
74
dialog.error_dialog('Directory is not a branch.')
148
self.dialog.error_dialog('Directory is not a branch.')
76
150
except errors.LocalRequiresBoundBranch:
77
dialog.error_dialog('Local commit requires a bound branch.')
79
except errors.EmptyMessageError:
80
dialog.error_dialog('Commit message is empty.')
82
except errors.NoChangesToCommitError:
83
dialog.error_dialog('No changes to commit. Try force commit.')
85
except errors.ConflictsInTreeError:
86
dialog.error_dialog('Conflicts in tree. Please resolve them first.')
88
except errors.StrictCommitError:
89
dialog.error_dialog('Strict commit failed. There are unknown files.')
151
self.dialog.error_dialog('Local commit requires a bound branch.')
153
except errors.PointlessCommit:
154
self.dialog.error_dialog('No changes to commit. Try force commit.')
156
except errors.ConflictsInTree:
157
self.dialog.error_dialog('Conflicts in tree. Please resolve them first.')
159
except errors.StrictCommitFailed:
160
self.dialog.error_dialog('Strict commit failed. There are unknown files.')
91
162
except errors.BoundBranchOutOfDate, errmsg:
92
dialog.error_dialog('Bound branch is out of date: %s' % errmsg)
163
self.dialog.error_dialog('Bound branch is out of date: %s' % errmsg)