/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-29 15:47:30 UTC
  • mto: This revision was merged to the branch mainline in revision 519.
  • Revision ID: jelmer@samba.org-20080629154730-xfsotoxwkiytf0ph
Pass graph object rather than full repository to linegraph.

Show diffs side-by-side

added added

removed removed

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