99
99
"""Implementation of Commit."""
101
101
def __init__(self, wt, selected=None, parent=None):
102
gtk.Dialog.__init__(self, title="Commit - Olive",
105
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
107
self._selected = selected
102
gtk.Dialog.__init__(self, title="Commit - Olive",
105
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
107
self._selected = selected
111
# These could potentially be set based on the size of your monitor.
112
# But for now, they seem like a reasonable default
113
self.set_default_size(800, 600)
114
self._hpane.set_position(300)
117
113
def setup_params(self):
118
114
"""Setup the member variables for state."""
165
159
renamed = _('renamed')
166
160
renamed_and_modified = _('renamed and modified')
167
161
modified = _('modified')
162
kind_changed = _('kind changed')
169
165
# [file_id, real path, checkbox, display path, changes type]
170
for path, file_id, kind in self._delta.added:
171
marker = osutils.kind_marker(kind)
172
store.append([file_id, path, True, path+marker, added])
174
for path, file_id, kind in self._delta.removed:
175
marker = osutils.kind_marker(kind)
176
store.append([file_id, path, True, path+marker, removed])
178
for oldpath, newpath, file_id, kind, text_mod, meta_mod in self._delta.renamed:
179
marker = osutils.kind_marker(kind)
180
if text_mod or meta_mod:
181
changes = renamed_and_modified
184
store.append([file_id, newpath, True,
185
oldpath+marker + ' => ' + newpath+marker,
189
for path, file_id, kind, text_mod, meta_mod in self._delta.modified:
190
marker = osutils.kind_marker(kind)
191
store.append([file_id, path, True, path+marker, modified])
166
# _iter_changes returns:
167
# (file_id, (path_in_source, path_in_target),
168
# changed_content, versioned, parent, name, kind,
171
# should we pass specific_files?
173
self._basis_tree.lock_read()
175
for (file_id, paths, changed_content, versioned, parent_ids, names,
176
kinds, executables) in self._wt._iter_changes(self._basis_tree):
178
# Skip the root entry.
179
if parent_ids == (None, None):
186
source_marker = osutils.kind_marker(kinds[0])
188
assert kinds[0] is not None
189
marker = osutils.kind_marker(kinds[0])
191
marker = osutils.kind_marker(kinds[1])
194
if real_path is None:
196
assert real_path is not None
197
display_path = real_path + marker
199
present_source = versioned[0] and kinds[0] is not None
200
present_target = versioned[1] and kinds[1] is not None
202
if present_source != present_target:
206
change_type = removed
207
elif names[0] != names[1] or parent_ids[0] != parent_ids[1]:
209
if changed_content or executables[0] != executables[1]:
211
change_type = renamed_and_modified
213
change_type = renamed
214
display_path = (paths[0] + source_marker
215
+ ' => ' + paths[1] + marker)
216
elif kinds[0] != kinds[1]:
217
change_type = kind_changed
218
display_path = (paths[0] + source_marker
219
+ ' => ' + paths[1] + marker)
220
elif changed_content is True or executables[0] != executables[1]:
221
change_type = modified
223
assert False, "How did we get here?"
225
store.append([file_id, real_path, True, display_path, change_type])
227
self._basis_tree.unlock()
193
230
self._treeview_files.set_model(store)