215
def _get_file_menuitems(self, tree, intertree, path):
216
file_id = tree.path2id(path)
218
item = Nautilus.MenuItem(name='BzrNautilus::add',
220
tip='Add as versioned file',
222
item.connect('activate', self.add_cb, tree, path)
225
item = Nautilus.MenuItem(name='BzrNautilus::ignore',
227
tip='Ignore file for versioning',
229
item.connect('activate', self.ignore_cb, tree, path)
231
elif tree.is_ignored(path):
232
item = Nautilus.MenuItem(name='BzrNautilus::unignore',
234
tip='Unignore file for versioning',
236
item.connect('activate', self.unignore_cb, tree, path)
239
item = Nautilus.MenuItem(name='BzrNautilus::log',
243
item.connect('activate', self.log_cb, tree.bzrdir, path)
246
if not intertree.file_content_matches(file_id, file_id):
247
item = Nautilus.MenuItem(name='BzrNautilus::diff',
248
label='View Changes ...',
249
tip='Show differences',
251
item.connect('activate', self.diff_cb, tree, path)
254
item = Nautilus.MenuItem(name='BzrNautilus::commit',
256
tip='Commit Changes',
258
item.connect('activate', self.commit_cb, tree, path)
261
item = Nautilus.MenuItem(name='BzrNautilus::remove',
263
tip='Remove this file from versioning',
265
item.connect('activate', self.remove_cb, tree, path)
268
item = Nautilus.MenuItem(name='BzrNautilus::annotate',
269
label='Annotate ...',
270
tip='Annotate File Data',
272
item.connect('activate', self.annotate_cb, tree, path, file_id)
215
275
def get_file_items(self, window, files):
218
for vfs_file in files:
219
controldir, path = self._open_bzrdir(vfs_file)
222
tree = controldir.open_workingtree()
223
except NoWorkingTree:
226
nautilus_integration = self.check_branch_enabled(tree.branch)
227
if not nautilus_integration:
230
file_id = tree.path2id(path)
232
item = Nautilus.MenuItem(name='BzrNautilus::add',
234
tip='Add as versioned file',
236
item.connect('activate', self.add_cb, tree, path)
239
item = Nautilus.MenuItem(name='BzrNautilus::ignore',
241
tip='Ignore file for versioning',
243
item.connect('activate', self.ignore_cb, tree, path)
245
elif tree.is_ignored(path):
246
item = Nautilus.MenuItem(name='BzrNautilus::unignore',
248
tip='Unignore file for versioning',
250
item.connect('activate', self.unignore_cb, tree, path)
253
item = Nautilus.MenuItem(name='BzrNautilus::log',
257
item.connect('activate', self.log_cb, controldir, path)
280
for vfs_file in files:
281
controldir, path = self._open_bzrdir(vfs_file)
284
tree = trees[controldir.user_url]
287
tree = controldir.open_workingtree()
288
except NoWorkingTree:
290
trees[controldir.user_url] = tree
293
nautilus_integration = self.check_branch_enabled(tree.branch)
294
if not nautilus_integration:
260
297
intertree = InterTree.get(tree.basis_tree(), tree)
261
if not intertree.file_content_matches(file_id, file_id):
262
item = Nautilus.MenuItem(name='BzrNautilus::diff',
263
label='View Changes ...',
264
tip='Show differences',
266
item.connect('activate', self.diff_cb, tree, path)
269
item = Nautilus.MenuItem(name='BzrNautilus::commit',
271
tip='Commit Changes',
273
item.connect('activate', self.commit_cb, tree, path)
276
item = Nautilus.MenuItem(name='BzrNautilus::remove',
278
tip='Remove this file from versioning',
280
item.connect('activate', self.remove_cb, tree, path)
283
item = Nautilus.MenuItem(name='BzrNautilus::annotate',
284
label='Annotate ...',
285
tip='Annotate File Data',
287
item.connect('activate', self.annotate_cb, tree, path, file_id)
298
items.extend(list(self._get_file_menuitems(tree, intertree, path)))
300
for tree in trees.itervalues():
291
305
def get_columns(self):
394
property_label = Gtk.Label('Version Control')
395
property_label.show()
397
408
file_id = tree.path2id(path)
399
table = Gtk.Table(homogeneous=False, columns=2, rows=2)
401
table.attach(Gtk.Label('File id:'), 0, 1, 0, 1)
402
table.attach(Gtk.Label(file_id), 1, 2, 0, 1)
404
table.attach(Gtk.Label('SHA1Sum:'), 0, 1, 1, 2)
405
table.attach(Gtk.Label(tree.get_file_sha1(file_id, path)), 1, 1, 1, 2)
408
pages.append(Nautilus.PropertyPage(name="BzrNautilus::version_info",
409
label=property_label, page=table))
409
pages.append(PropertyPageFile(tree, file_id, path))
410
pages.append(PropertyPageBranch(tree.branch))
416
class PropertyPageFile(Nautilus.PropertyPage):
418
def __init__(self, tree, file_id, path):
420
self.file_id = file_id
422
label = Gtk.Label('File Version')
425
table = self._create_table()
427
super(PropertyPageFile, self).__init__(label=label,
428
name="BzrNautilus::file_page", page=table)
430
def _create_table(self):
431
table = Gtk.Table(homogeneous=False, columns=2, rows=3)
433
table.attach(Gtk.Label('File id:'), 0, 1, 0, 1)
434
table.attach(Gtk.Label(self.file_id), 1, 2, 0, 1)
436
table.attach(Gtk.Label('SHA1Sum:'), 0, 1, 1, 2)
437
table.attach(Gtk.Label(self.tree.get_file_sha1(self.file_id, self.path)), 1, 1, 1, 2)
439
basis_tree = self.tree.revision_tree(self.tree.last_revision())
440
last_revision = basis_tree.get_file_revision(self.file_id)
442
table.attach(Gtk.Label('Last Change Revision:'), 0, 1, 2, 3)
443
revno = ".".join([str(x) for x in
444
self.tree.branch.revision_id_to_dotted_revno(last_revision)])
445
table.attach(Gtk.Label(revno), 1, 1, 2, 3)
447
table.attach(Gtk.Label('Last Change Author:'), 0, 1, 3, 4)
448
rev = self.tree.branch.repository.get_revision(last_revision)
449
table.attach(Gtk.Label("\n".join(rev.get_apparent_authors())), 1, 1, 3, 4)
455
class PropertyPageBranch(Nautilus.PropertyPage):
457
def __init__(self, branch):
459
label = Gtk.Label('Branch')
462
table = self._create_table()
464
super(PropertyPageBranch, self).__init__(label=label,
465
name="BzrNautilus::branch_page", page=table)
467
def _create_table(self):
468
table = Gtk.Table(homogeneous=False, columns=2, rows=3)
470
table.attach(Gtk.Label('Push location:'), 0, 1, 0, 1)
471
table.attach(Gtk.Label(self.branch.get_push_location()), 1, 2, 0, 1)
473
table.attach(Gtk.Label('Parent location:'), 0, 1, 1, 2)
474
table.attach(Gtk.Label(self.branch.get_parent()), 1, 1, 1, 2)