/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: 2011-03-02 15:24:46 UTC
  • Revision ID: jelmer@samba.org-20110302152446-q8iogg8f2rweh25s
startĀ onĀ 0.101.0

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