/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to nautilus-bzr.py

  • Committer: Jelmer Vernooij
  • Date: 2008-06-27 16:55:09 UTC
  • mto: This revision was merged to the branch mainline in revision 506.
  • Revision ID: jelmer@samba.org-20080627165509-7b68w2chzvvgc8vz
Use helper script to open patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from bzrlib.plugin import load_plugins
20
20
load_plugins()
21
21
 
22
 
from bzrlib.plugins.gtk import _i18n
23
 
from bzrlib.plugins.gtk.commands import cmd_gannotate, start_viz_window
24
 
 
25
 
print "Bazaar nautilus module initialized"
26
 
 
 
22
from bzrlib.plugins.gtk import _i18n, cmd_visualise, cmd_gannotate
27
23
 
28
24
class BzrExtension(nautilus.MenuProvider, nautilus.ColumnProvider, nautilus.InfoProvider):
29
25
    def __init__(self):
87
83
 
88
84
        from bzrlib.plugins.gtk.diff import DiffWindow
89
85
        window = DiffWindow()
90
 
        window.set_diff(tree.branch._get_nick(local=True), tree, 
91
 
                        tree.branch.basis_tree())
 
86
        window.set_diff(tree.branch.nick, tree, tree.branch.basis_tree())
92
87
        window.show()
93
88
 
94
89
        return
179
174
 
180
175
        # We only want to continue here if we get a NotBranchError
181
176
        try:
182
 
            branch, path = Branch.open_containing(file)
 
177
            tree, path = WorkingTree.open_containing(file)
183
178
        except NotBranchError:
184
179
            return
185
180
 
186
 
        pp = start_viz_window(branch, [branch.last_revision()])
187
 
        pp.show()
188
 
        gtk.main()
 
181
        vis = cmd_visualise()
 
182
        vis.run(file)
 
183
 
 
184
        return
189
185
 
190
186
    def pull_cb(self, menu, vfs_file):
191
187
        # We can only cope with local files
220
216
 
221
217
        from bzrlib.plugins.gtk.merge import MergeDialog
222
218
        dialog = MergeDialog(tree, path)
223
 
        dialog.run()
224
 
        dialog.destroy()
 
219
        dialog.display()
 
220
        gtk.main()
225
221
 
226
222
    def get_background_items(self, window, vfs_file):
227
223
        items = []
241
237
            items.append(item)
242
238
 
243
239
            item = nautilus.MenuItem('BzrNautilus::clone',
244
 
                                 'Checkout Bazaar branch ...',
 
240
                                 'Checkout Bazaar branch',
245
241
                                 'Checkout Existing Bazaar Branch')
246
242
            item.connect('activate', self.clone_cb, vfs_file)
247
243
            items.append(item)
258
254
            return item,
259
255
        else:
260
256
            item = nautilus.MenuItem('BzrNautilus::disable',
261
 
                                      'Disable Bazaar Plugin this Branch',
 
257
                                      'Disable Bazaar Plugin for the Branch',
262
258
                                      'Disable Bazaar plugin for nautilus')
263
259
            item.connect('activate', self.toggle_integration, 'False', vfs_file)
264
260
            items.append(item)
265
261
 
266
262
        item = nautilus.MenuItem('BzrNautilus::log',
267
 
                             'History ...',
 
263
                             'Log',
268
264
                             'Show Bazaar history')
269
265
        item.connect('activate', self.log_cb, vfs_file)
270
266
        items.append(item)
271
267
 
272
268
        item = nautilus.MenuItem('BzrNautilus::pull',
273
 
                             'Pull ...',
 
269
                             'Pull',
274
270
                             'Pull from another branch')
275
271
        item.connect('activate', self.pull_cb, vfs_file)
276
272
        items.append(item)
277
273
 
278
274
        item = nautilus.MenuItem('BzrNautilus::merge',
279
 
                             'Merge ...',
 
275
                             'Merge',
280
276
                             'Merge from another branch')
281
277
        item.connect('activate', self.merge_cb, vfs_file)
282
278
        items.append(item)
283
279
 
284
280
        item = nautilus.MenuItem('BzrNautilus::commit',
285
 
                             'Commit ...',
 
281
                             'Commit',
286
282
                             'Commit Changes')
287
283
        item.connect('activate', self.commit_cb, vfs_file)
288
284
        items.append(item)
345
341
                items.append(item)
346
342
            elif wtfiles[path] == 'V':
347
343
                item = nautilus.MenuItem('BzrNautilus::log',
348
 
                                 'History ...',
 
344
                                 'Log',
349
345
                                 'List changes')
350
346
                item.connect('activate', self.log_cb, vfs_file)
351
347
                items.append(item)
352
348
 
353
349
                item = nautilus.MenuItem('BzrNautilus::diff',
354
 
                                 'View Changes ...',
 
350
                                 'Diff',
355
351
                                 'Show differences')
356
352
                item.connect('activate', self.diff_cb, vfs_file)
357
353
                items.append(item)
363
359
                items.append(item)
364
360
 
365
361
                item = nautilus.MenuItem('BzrNautilus::annotate',
366
 
                             'Annotate ...',
 
362
                             'Annotate',
367
363
                             'Annotate File Data')
368
364
                item.connect('activate', self.annotate_cb, vfs_file)
369
365
                items.append(item)
370
366
 
371
367
                item = nautilus.MenuItem('BzrNautilus::commit',
372
 
                             'Commit ...',
 
368
                             'Commit',
373
369
                             'Commit Changes')
374
370
                item.connect('activate', self.commit_cb, vfs_file)
375
371
                items.append(item)
401
397
        emblem = None
402
398
        status = None
403
399
 
404
 
        id = tree.path2id(path)
405
 
        if id == None:
406
 
            if tree.is_ignored(path):
407
 
                status = 'ignored'
408
 
                emblem = 'bzr-ignored'
409
 
            else:
410
 
                status = 'unversioned'
411
 
                        
412
 
        elif tree.has_filename(path):
 
400
        if tree.has_filename(path):
413
401
            emblem = 'bzr-controlled'
414
402
            status = 'unchanged'
 
403
            id = tree.path2id(path)
415
404
 
416
405
            delta = tree.changes_from(tree.branch.basis_tree())
417
406
            if delta.touches_file_id(id):