bzr branch
http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
| 
164
by Jelmer Vernooij
 Add copyright information.  | 
1  | 
# Trivial Bazaar plugin for Nautilus
 | 
2  | 
#
 | 
|
3  | 
# Copyright (C) 2006 Jeff Bailey
 | 
|
4  | 
# Copyright (C) 2006 Wouter van Heyst
 | 
|
5  | 
# Copyright (C) 2006 Jelmer Vernooij
 | 
|
6  | 
#
 | 
|
7  | 
# Published under the GNU GPL
 | 
|
8  | 
||
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
9  | 
import gtk  | 
| 
0.5.1
by Jelmer Vernooij
 Start working on bzr integration plugin for nautilus  | 
10  | 
import nautilus  | 
11  | 
import bzrlib  | 
|
12  | 
from bzrlib.bzrdir import BzrDir  | 
|
| 
0.5.2
by jbailey at ubuntu
 Bring this to a state where it actually works. Specifically:  | 
13  | 
from bzrlib.errors import NotBranchError  | 
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
14  | 
from bzrlib.errors import NoWorkingTree  | 
15  | 
from bzrlib.errors import UnsupportedProtocol  | 
|
| 
0.5.2
by jbailey at ubuntu
 Bring this to a state where it actually works. Specifically:  | 
16  | 
from bzrlib.workingtree import WorkingTree  | 
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
17  | 
from bzrlib.branch import Branch  | 
| 
88
by Jelmer Vernooij
 Show column with file status.  | 
18  | 
from bzrlib.tree import file_status  | 
| 
0.5.1
by Jelmer Vernooij
 Start working on bzr integration plugin for nautilus  | 
19  | 
|
| 
0.7.1
by Wouter van Heyst
 use the bzrlib method of loading plugins, takes care of ~/.bazaar/plugins  | 
20  | 
from bzrlib.plugin import load_plugins  | 
21  | 
load_plugins()  | 
|
22  | 
||
| 
81
by Jelmer Vernooij
 Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125).  | 
23  | 
from bzrlib.plugins.gtk import cmd_visualise, cmd_gannotate  | 
| 
0.6.2
by Jelmer Vernooij
 Add 'Annotate' menu entry that uses the gannotate bzr plugin  | 
24  | 
|
| 
88
by Jelmer Vernooij
 Show column with file status.  | 
25  | 
class BzrExtension(nautilus.MenuProvider, nautilus.ColumnProvider, nautilus.InfoProvider):  | 
| 
0.5.1
by Jelmer Vernooij
 Start working on bzr integration plugin for nautilus  | 
26  | 
def __init__(self):  | 
27  | 
        pass
 | 
|
28  | 
||
| 
0.5.4
by jbailey at ubuntu
 Add 'add' function. Give framework for other callbacks.  | 
29  | 
def add_cb(self, menu, vfs_file):  | 
30  | 
        # We can only cope with local files
 | 
|
31  | 
if vfs_file.get_uri_scheme() != 'file':  | 
|
32  | 
            return
 | 
|
33  | 
||
34  | 
file = vfs_file.get_uri()  | 
|
35  | 
try:  | 
|
36  | 
tree, path = WorkingTree.open_containing(file)  | 
|
37  | 
except NotBranchError:  | 
|
38  | 
            return
 | 
|
39  | 
||
40  | 
tree.add(path)  | 
|
41  | 
||
42  | 
        return
 | 
|
43  | 
||
44  | 
def ignore_cb(self, menu, vfs_file):  | 
|
45  | 
        # We can only cope with local files
 | 
|
46  | 
if vfs_file.get_uri_scheme() != 'file':  | 
|
47  | 
            return
 | 
|
48  | 
||
49  | 
file = vfs_file.get_uri()  | 
|
50  | 
try:  | 
|
51  | 
tree, path = WorkingTree.open_containing(file)  | 
|
52  | 
except NotBranchError:  | 
|
53  | 
            return
 | 
|
54  | 
||
| 
0.5.16
by Jelmer Vernooij
 Adapt to bzr-gtk's API changes, add 'Clone' dialog  | 
55  | 
        #FIXME
 | 
56  | 
||
| 
0.5.4
by jbailey at ubuntu
 Add 'add' function. Give framework for other callbacks.  | 
57  | 
        return
 | 
58  | 
||
59  | 
def unignore_cb(self, menu, vfs_file):  | 
|
60  | 
        # We can only cope with local files
 | 
|
61  | 
if vfs_file.get_uri_scheme() != 'file':  | 
|
62  | 
            return
 | 
|
63  | 
||
64  | 
file = vfs_file.get_uri()  | 
|
65  | 
try:  | 
|
66  | 
tree, path = WorkingTree.open_containing(file)  | 
|
67  | 
except NotBranchError:  | 
|
68  | 
            return
 | 
|
69  | 
||
| 
0.5.16
by Jelmer Vernooij
 Adapt to bzr-gtk's API changes, add 'Clone' dialog  | 
70  | 
        #FIXME
 | 
71  | 
||
| 
0.5.4
by jbailey at ubuntu
 Add 'add' function. Give framework for other callbacks.  | 
72  | 
        return
 | 
73  | 
||
74  | 
def diff_cb(self, menu, vfs_file):  | 
|
75  | 
        # We can only cope with local files
 | 
|
76  | 
if vfs_file.get_uri_scheme() != 'file':  | 
|
77  | 
            return
 | 
|
78  | 
||
79  | 
file = vfs_file.get_uri()  | 
|
80  | 
try:  | 
|
81  | 
tree, path = WorkingTree.open_containing(file)  | 
|
82  | 
except NotBranchError:  | 
|
83  | 
            return
 | 
|
84  | 
||
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
85  | 
from bzrlib.plugins.gtk.diff import DiffWindow  | 
| 
0.5.13
by Jelmer Vernooij
 Use the gtk plugin rather than separate bzrk and gannotate  | 
86  | 
window = DiffWindow()  | 
| 
87
by Jelmer Vernooij
 Fix diff window in nautilus.  | 
87  | 
window.set_diff(tree.branch.nick, tree, tree.branch.basis_tree())  | 
| 
0.5.13
by Jelmer Vernooij
 Use the gtk plugin rather than separate bzrk and gannotate  | 
88  | 
window.show()  | 
89  | 
||
| 
0.5.4
by jbailey at ubuntu
 Add 'add' function. Give framework for other callbacks.  | 
90  | 
        return
 | 
91  | 
||
| 
0.5.7
by jbailey at ubuntu
 Add hook for creating new bzr trees.  | 
92  | 
def newtree_cb(self, menu, vfs_file):  | 
93  | 
        # We can only cope with local files
 | 
|
94  | 
if vfs_file.get_uri_scheme() != 'file':  | 
|
95  | 
            return
 | 
|
96  | 
||
97  | 
file = vfs_file.get_uri()  | 
|
98  | 
||
99  | 
        # We only want to continue here if we get a NotBranchError
 | 
|
100  | 
try:  | 
|
101  | 
tree, path = WorkingTree.open_containing(file)  | 
|
102  | 
except NotBranchError:  | 
|
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
103  | 
BzrDir.create_standalone_workingtree(file)  | 
| 
0.5.7
by jbailey at ubuntu
 Add hook for creating new bzr trees.  | 
104  | 
|
| 
0.5.4
by jbailey at ubuntu
 Add 'add' function. Give framework for other callbacks.  | 
105  | 
def remove_cb(self, menu, vfs_file):  | 
106  | 
        # We can only cope with local files
 | 
|
107  | 
if vfs_file.get_uri_scheme() != 'file':  | 
|
108  | 
            return
 | 
|
109  | 
||
110  | 
file = vfs_file.get_uri()  | 
|
111  | 
try:  | 
|
112  | 
tree, path = WorkingTree.open_containing(file)  | 
|
113  | 
except NotBranchError:  | 
|
114  | 
            return
 | 
|
115  | 
||
| 
0.5.6
by jbailey at ubuntu
 Implement remove  | 
116  | 
tree.remove(path)  | 
117  | 
||
| 
0.6.2
by Jelmer Vernooij
 Add 'Annotate' menu entry that uses the gannotate bzr plugin  | 
118  | 
def annotate_cb(self, menu, vfs_file):  | 
119  | 
        # We can only cope with local files
 | 
|
120  | 
if vfs_file.get_uri_scheme() != 'file':  | 
|
121  | 
            return
 | 
|
122  | 
||
123  | 
file = vfs_file.get_uri()  | 
|
124  | 
||
125  | 
vis = cmd_gannotate()  | 
|
126  | 
vis.run(file)  | 
|
| 
0.5.16
by Jelmer Vernooij
 Adapt to bzr-gtk's API changes, add 'Clone' dialog  | 
127  | 
|
128  | 
def clone_cb(self, menu, vfs_file=None):  | 
|
129  | 
        # We can only cope with local files
 | 
|
130  | 
if vfs_file.get_uri_scheme() != 'file':  | 
|
131  | 
            return
 | 
|
132  | 
||
| 
142
by Jelmer Vernooij
 Move some files to the top-level directory, add first test.  | 
133  | 
from bzrlib.plugins.gtk.branch import BranchDialog  | 
| 
90
by Jelmer Vernooij
 Use Olive's clone dialog in nautilus-bzr; remove the old Clone dialog  | 
134  | 
|
135  | 
dialog = BranchDialog(vfs_file.get_name())  | 
|
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
136  | 
response = dialog.run()  | 
137  | 
if response != gtk.RESPONSE_NONE:  | 
|
138  | 
dialog.hide()  | 
|
139  | 
dialog.destroy()  | 
|
| 
0.6.2
by Jelmer Vernooij
 Add 'Annotate' menu entry that uses the gannotate bzr plugin  | 
140  | 
|
| 
0.5.15
by Jelmer Vernooij
 Add 'Commit' entries  | 
141  | 
def commit_cb(self, menu, vfs_file=None):  | 
142  | 
        # We can only cope with local files
 | 
|
143  | 
if vfs_file.get_uri_scheme() != 'file':  | 
|
144  | 
            return
 | 
|
145  | 
||
146  | 
file = vfs_file.get_uri()  | 
|
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
147  | 
tree = None  | 
148  | 
branch = None  | 
|
| 
0.5.15
by Jelmer Vernooij
 Add 'Commit' entries  | 
149  | 
try:  | 
150  | 
tree, path = WorkingTree.open_containing(file)  | 
|
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
151  | 
branch = tree.branch  | 
152  | 
except NotBranchError, e:  | 
|
153  | 
path = e.path  | 
|
154  | 
            #return
 | 
|
155  | 
except NoWorkingTree, e:  | 
|
156  | 
path = e.base  | 
|
157  | 
try:  | 
|
158  | 
(branch, path) = Branch.open_containing(path)  | 
|
159  | 
except NotBranchError, e:  | 
|
160  | 
path = e.path  | 
|
| 
0.5.15
by Jelmer Vernooij
 Add 'Commit' entries  | 
161  | 
|
| 
142
by Jelmer Vernooij
 Move some files to the top-level directory, add first test.  | 
162  | 
from bzrlib.plugins.gtk.commit import CommitDialog  | 
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
163  | 
dialog = CommitDialog(tree, path, not branch)  | 
164  | 
response = dialog.run()  | 
|
165  | 
if response != gtk.RESPONSE_NONE:  | 
|
166  | 
dialog.hide()  | 
|
167  | 
dialog.destroy()  | 
|
| 
0.6.2
by Jelmer Vernooij
 Add 'Annotate' menu entry that uses the gannotate bzr plugin  | 
168  | 
|
| 
0.5.12
by Jelmer Vernooij
 Rename "Visualise Bazaar Branch" to "Log", which is a term  | 
169  | 
def log_cb(self, menu, vfs_file):  | 
| 
0.5.8
by jbailey at ubuntu
 Add bzrk plugin  | 
170  | 
        # We can only cope with local files
 | 
171  | 
if vfs_file.get_uri_scheme() != 'file':  | 
|
172  | 
            return
 | 
|
173  | 
||
174  | 
file = vfs_file.get_uri()  | 
|
175  | 
||
176  | 
        # We only want to continue here if we get a NotBranchError
 | 
|
177  | 
try:  | 
|
178  | 
tree, path = WorkingTree.open_containing(file)  | 
|
179  | 
except NotBranchError:  | 
|
180  | 
            return
 | 
|
181  | 
||
182  | 
vis = cmd_visualise()  | 
|
183  | 
vis.run(file)  | 
|
184  | 
||
185  | 
        return
 | 
|
186  | 
||
| 
91.1.4
by Jelmer Vernooij
 List pull and merge in nautilus-bzr.  | 
187  | 
def pull_cb(self, menu, vfs_file):  | 
188  | 
        # We can only cope with local files
 | 
|
189  | 
if vfs_file.get_uri_scheme() != 'file':  | 
|
190  | 
            return
 | 
|
191  | 
||
192  | 
file = vfs_file.get_uri()  | 
|
193  | 
||
194  | 
        # We only want to continue here if we get a NotBranchError
 | 
|
195  | 
try:  | 
|
196  | 
tree, path = WorkingTree.open_containing(file)  | 
|
197  | 
except NotBranchError:  | 
|
198  | 
            return
 | 
|
199  | 
||
| 
142
by Jelmer Vernooij
 Move some files to the top-level directory, add first test.  | 
200  | 
from bzrlib.plugins.gtk.pull import PullDialog  | 
| 
91.1.4
by Jelmer Vernooij
 List pull and merge in nautilus-bzr.  | 
201  | 
dialog = PullDialog(tree, path)  | 
202  | 
dialog.display()  | 
|
203  | 
gtk.main()  | 
|
204  | 
||
205  | 
def merge_cb(self, menu, vfs_file):  | 
|
206  | 
        # We can only cope with local files
 | 
|
207  | 
if vfs_file.get_uri_scheme() != 'file':  | 
|
208  | 
            return
 | 
|
209  | 
||
210  | 
file = vfs_file.get_uri()  | 
|
211  | 
||
212  | 
        # We only want to continue here if we get a NotBranchError
 | 
|
213  | 
try:  | 
|
214  | 
tree, path = WorkingTree.open_containing(file)  | 
|
215  | 
except NotBranchError:  | 
|
216  | 
            return
 | 
|
217  | 
||
| 
142
by Jelmer Vernooij
 Move some files to the top-level directory, add first test.  | 
218  | 
from bzrlib.plugins.gtk.merge import MergeDialog  | 
| 
91.1.4
by Jelmer Vernooij
 List pull and merge in nautilus-bzr.  | 
219  | 
dialog = MergeDialog(tree, path)  | 
220  | 
dialog.display()  | 
|
221  | 
gtk.main()  | 
|
222  | 
||
| 
0.5.7
by jbailey at ubuntu
 Add hook for creating new bzr trees.  | 
223  | 
def get_background_items(self, window, vfs_file):  | 
| 
90
by Jelmer Vernooij
 Use Olive's clone dialog in nautilus-bzr; remove the old Clone dialog  | 
224  | 
items = []  | 
| 
0.5.7
by jbailey at ubuntu
 Add hook for creating new bzr trees.  | 
225  | 
file = vfs_file.get_uri()  | 
226  | 
try:  | 
|
227  | 
tree, path = WorkingTree.open_containing(file)  | 
|
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
228  | 
except UnsupportedProtocol:  | 
229  | 
            return
 | 
|
| 
0.5.7
by jbailey at ubuntu
 Add hook for creating new bzr trees.  | 
230  | 
except NotBranchError:  | 
231  | 
item = nautilus.MenuItem('BzrNautilus::newtree',  | 
|
| 
91
by Jelmer Vernooij
 Some update to TODO.  | 
232  | 
'Make directory versioned',  | 
| 
0.5.7
by jbailey at ubuntu
 Add hook for creating new bzr trees.  | 
233  | 
'Create new Bazaar tree in this folder')  | 
234  | 
item.connect('activate', self.newtree_cb, vfs_file)  | 
|
| 
0.5.16
by Jelmer Vernooij
 Adapt to bzr-gtk's API changes, add 'Clone' dialog  | 
235  | 
items.append(item)  | 
236  | 
||
237  | 
item = nautilus.MenuItem('BzrNautilus::clone',  | 
|
| 
91
by Jelmer Vernooij
 Some update to TODO.  | 
238  | 
'Checkout Bazaar branch',  | 
| 
0.5.16
by Jelmer Vernooij
 Adapt to bzr-gtk's API changes, add 'Clone' dialog  | 
239  | 
'Checkout Existing Bazaar Branch')  | 
240  | 
item.connect('activate', self.clone_cb, vfs_file)  | 
|
241  | 
items.append(item)  | 
|
242  | 
||
243  | 
return items  | 
|
| 
0.5.8
by jbailey at ubuntu
 Add bzrk plugin  | 
244  | 
|
| 
81
by Jelmer Vernooij
 Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125).  | 
245  | 
item = nautilus.MenuItem('BzrNautilus::log',  | 
246  | 
'Log',  | 
|
247  | 
'Show Bazaar history')  | 
|
248  | 
item.connect('activate', self.log_cb, vfs_file)  | 
|
249  | 
items.append(item)  | 
|
| 
0.5.15
by Jelmer Vernooij
 Add 'Commit' entries  | 
250  | 
|
| 
91.1.4
by Jelmer Vernooij
 List pull and merge in nautilus-bzr.  | 
251  | 
item = nautilus.MenuItem('BzrNautilus::pull',  | 
252  | 
'Pull',  | 
|
253  | 
'Pull from another branch')  | 
|
254  | 
item.connect('activate', self.pull_cb, vfs_file)  | 
|
255  | 
items.append(item)  | 
|
256  | 
||
257  | 
item = nautilus.MenuItem('BzrNautilus::merge',  | 
|
258  | 
'Merge',  | 
|
259  | 
'Merge from another branch')  | 
|
260  | 
item.connect('activate', self.merge_cb, vfs_file)  | 
|
261  | 
items.append(item)  | 
|
262  | 
||
| 
81
by Jelmer Vernooij
 Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125).  | 
263  | 
item = nautilus.MenuItem('BzrNautilus::commit',  | 
264  | 
'Commit',  | 
|
265  | 
'Commit Changes')  | 
|
266  | 
item.connect('activate', self.commit_cb, vfs_file)  | 
|
267  | 
items.append(item)  | 
|
| 
0.5.15
by Jelmer Vernooij
 Add 'Commit' entries  | 
268  | 
|
269  | 
return items  | 
|
| 
0.5.7
by jbailey at ubuntu
 Add hook for creating new bzr trees.  | 
270  | 
|
271  | 
||
| 
0.5.1
by Jelmer Vernooij
 Start working on bzr integration plugin for nautilus  | 
272  | 
def get_file_items(self, window, files):  | 
273  | 
items = []  | 
|
| 
0.5.2
by jbailey at ubuntu
 Bring this to a state where it actually works. Specifically:  | 
274  | 
|
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
275  | 
wtfiles = {}  | 
| 
0.5.2
by jbailey at ubuntu
 Bring this to a state where it actually works. Specifically:  | 
276  | 
for vfs_file in files:  | 
277  | 
            # We can only cope with local files
 | 
|
278  | 
if vfs_file.get_uri_scheme() != 'file':  | 
|
279  | 
                return
 | 
|
280  | 
||
281  | 
file = vfs_file.get_uri()  | 
|
| 
0.5.1
by Jelmer Vernooij
 Start working on bzr integration plugin for nautilus  | 
282  | 
try:  | 
| 
0.5.2
by jbailey at ubuntu
 Bring this to a state where it actually works. Specifically:  | 
283  | 
tree, path = WorkingTree.open_containing(file)  | 
| 
0.5.1
by Jelmer Vernooij
 Start working on bzr integration plugin for nautilus  | 
284  | 
except NotBranchError:  | 
| 
0.5.7
by jbailey at ubuntu
 Add hook for creating new bzr trees.  | 
285  | 
if not vfs_file.is_directory():  | 
286  | 
                    return
 | 
|
287  | 
item = nautilus.MenuItem('BzrNautilus::newtree',  | 
|
| 
91
by Jelmer Vernooij
 Some update to TODO.  | 
288  | 
'Make directory versioned',  | 
| 
0.5.7
by jbailey at ubuntu
 Add hook for creating new bzr trees.  | 
289  | 
'Create new Bazaar tree in %s' % vfs_file.get_name())  | 
290  | 
item.connect('activate', self.newtree_cb, vfs_file)  | 
|
291  | 
return item,  | 
|
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
292  | 
            # Refresh the list of filestatuses in the working tree
 | 
293  | 
if path not in wtfiles.keys():  | 
|
294  | 
tree.lock_read()  | 
|
295  | 
for rpath, file_class, kind, id, entry in tree.list_files():  | 
|
296  | 
wtfiles[rpath] = file_class  | 
|
297  | 
tree.unlock()  | 
|
298  | 
wtfiles[u''] = 'V'  | 
|
299  | 
||
300  | 
if wtfiles[path] == '?':  | 
|
| 
0.5.2
by jbailey at ubuntu
 Bring this to a state where it actually works. Specifically:  | 
301  | 
item = nautilus.MenuItem('BzrNautilus::add',  | 
302  | 
'Add',  | 
|
303  | 
'Add as versioned file')  | 
|
304  | 
item.connect('activate', self.add_cb, vfs_file)  | 
|
305  | 
items.append(item)  | 
|
306  | 
||
307  | 
item = nautilus.MenuItem('BzrNautilus::ignore',  | 
|
308  | 
'Ignore',  | 
|
309  | 
'Ignore file for versioning')  | 
|
310  | 
item.connect('activate', self.ignore_cb, vfs_file)  | 
|
311  | 
items.append(item)  | 
|
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
312  | 
elif wtfiles[path] == 'I':  | 
| 
0.5.2
by jbailey at ubuntu
 Bring this to a state where it actually works. Specifically:  | 
313  | 
item = nautilus.MenuItem('BzrNautilus::unignore',  | 
314  | 
'Unignore',  | 
|
315  | 
'Unignore file for versioning')  | 
|
316  | 
item.connect('activate', self.unignore_cb, vfs_file)  | 
|
317  | 
items.append(item)  | 
|
| 
419
by Szilveszter Farkas
 Applied nautilus-bzr patches by Toshio Kuratomi.  | 
318  | 
elif wtfiles[path] == 'V':  | 
| 
81
by Jelmer Vernooij
 Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125).  | 
319  | 
item = nautilus.MenuItem('BzrNautilus::log',  | 
320  | 
'Log',  | 
|
321  | 
'List changes')  | 
|
322  | 
item.connect('activate', self.log_cb, vfs_file)  | 
|
323  | 
items.append(item)  | 
|
| 
0.5.2
by jbailey at ubuntu
 Bring this to a state where it actually works. Specifically:  | 
324  | 
|
| 
81
by Jelmer Vernooij
 Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125).  | 
325  | 
item = nautilus.MenuItem('BzrNautilus::diff',  | 
326  | 
'Diff',  | 
|
327  | 
'Show differences')  | 
|
328  | 
item.connect('activate', self.diff_cb, vfs_file)  | 
|
329  | 
items.append(item)  | 
|
| 
0.5.2
by jbailey at ubuntu
 Bring this to a state where it actually works. Specifically:  | 
330  | 
|
331  | 
item = nautilus.MenuItem('BzrNautilus::remove',  | 
|
332  | 
'Remove',  | 
|
333  | 
'Remove this file from versioning')  | 
|
334  | 
item.connect('activate', self.remove_cb, vfs_file)  | 
|
335  | 
items.append(item)  | 
|
| 
0.6.2
by Jelmer Vernooij
 Add 'Annotate' menu entry that uses the gannotate bzr plugin  | 
336  | 
|
| 
81
by Jelmer Vernooij
 Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125).  | 
337  | 
item = nautilus.MenuItem('BzrNautilus::annotate',  | 
338  | 
'Annotate',  | 
|
339  | 
'Annotate File Data')  | 
|
340  | 
item.connect('activate', self.annotate_cb, vfs_file)  | 
|
341  | 
items.append(item)  | 
|
342  | 
||
343  | 
item = nautilus.MenuItem('BzrNautilus::commit',  | 
|
344  | 
'Commit',  | 
|
345  | 
'Commit Changes')  | 
|
346  | 
item.connect('activate', self.commit_cb, vfs_file)  | 
|
347  | 
items.append(item)  | 
|
348  | 
||
| 
0.5.1
by Jelmer Vernooij
 Start working on bzr integration plugin for nautilus  | 
349  | 
return items  | 
| 
88
by Jelmer Vernooij
 Show column with file status.  | 
350  | 
|
351  | 
def get_columns(self):  | 
|
352  | 
return nautilus.Column("BzrNautilus::bzr_status",  | 
|
353  | 
"bzr_status",  | 
|
354  | 
"Bzr Status",  | 
|
355  | 
"Version control status"),  | 
|
356  | 
||
357  | 
def update_file_info(self, file):  | 
|
358  | 
if file.get_uri_scheme() != 'file':  | 
|
359  | 
            return
 | 
|
360  | 
||
361  | 
try:  | 
|
362  | 
tree, path = WorkingTree.open_containing(file.get_uri())  | 
|
363  | 
except NotBranchError:  | 
|
364  | 
            return
 | 
|
365  | 
||
366  | 
emblem = None  | 
|
367  | 
status = None  | 
|
368  | 
||
369  | 
if tree.has_filename(path):  | 
|
370  | 
emblem = 'cvs-controlled'  | 
|
371  | 
status = 'unchanged'  | 
|
372  | 
id = tree.path2id(path)  | 
|
373  | 
||
374  | 
delta = tree.changes_from(tree.branch.basis_tree())  | 
|
375  | 
if delta.touches_file_id(id):  | 
|
376  | 
emblem = 'cvs-modified'  | 
|
377  | 
status = 'modified'  | 
|
378  | 
for f, _, _ in delta.added:  | 
|
379  | 
if f == path:  | 
|
380  | 
emblem = 'cvs-added'  | 
|
381  | 
status = 'added'  | 
|
382  | 
||
383  | 
for of, f, _, _, _, _ in delta.renamed:  | 
|
384  | 
if f == path:  | 
|
385  | 
status = 'renamed from %s' % f  | 
|
386  | 
||
387  | 
elif tree.branch.basis_tree().has_filename(path):  | 
|
388  | 
emblem = 'cvs-removed'  | 
|
389  | 
status = 'removed'  | 
|
390  | 
else:  | 
|
391  | 
            # FIXME: Check for ignored files
 | 
|
392  | 
status = 'unversioned'  | 
|
393  | 
||
394  | 
if emblem is not None:  | 
|
395  | 
file.add_emblem(emblem)  | 
|
396  | 
file.add_string_attribute('bzr_status', status)  |