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
|
|
423.13.1
by Jelmer Vernooij
Fix handling of NoWorkingTree error. |
5 |
# Copyright (C) 2006-2008 Jelmer Vernooij <jelmer@samba.org>
|
164
by Jelmer Vernooij
Add copyright information. |
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 |
|
423.13.1
by Jelmer Vernooij
Fix handling of NoWorkingTree error. |
12 |
from bzrlib.branch import Branch |
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
13 |
from bzrlib.bzrdir import BzrDir |
423.13.1
by Jelmer Vernooij
Fix handling of NoWorkingTree error. |
14 |
from bzrlib.errors import NotBranchError, NoWorkingTree, UnsupportedProtocol |
15 |
from bzrlib.tree import file_status |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
16 |
from bzrlib.workingtree import WorkingTree |
454
by Martin Albisetti
Add the logic to enable/disable the plugin |
17 |
from bzrlib.config import GlobalConfig |
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
18 |
|
0.7.1
by Wouter van Heyst
use the bzrlib method of loading plugins, takes care of ~/.bazaar/plugins |
19 |
from bzrlib.plugin import load_plugins |
20 |
load_plugins() |
|
21 |
||
649.1.1
by Alexandre Défossez
import error fixed |
22 |
from bzrlib.plugins.gtk import _i18n |
23 |
from bzrlib.plugins.gtk.commands import cmd_gannotate, start_viz_window |
|
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
24 |
|
25 |
print "Bazaar nautilus module initialized" |
|
26 |
||
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
27 |
|
88
by Jelmer Vernooij
Show column with file status. |
28 |
class BzrExtension(nautilus.MenuProvider, nautilus.ColumnProvider, nautilus.InfoProvider): |
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
29 |
def __init__(self): |
30 |
pass
|
|
31 |
||
0.5.4
by jbailey at ubuntu
Add 'add' function. Give framework for other callbacks. |
32 |
def add_cb(self, menu, vfs_file): |
33 |
# We can only cope with local files
|
|
34 |
if vfs_file.get_uri_scheme() != 'file': |
|
35 |
return
|
|
36 |
||
37 |
file = vfs_file.get_uri() |
|
38 |
try: |
|
39 |
tree, path = WorkingTree.open_containing(file) |
|
40 |
except NotBranchError: |
|
41 |
return
|
|
42 |
||
43 |
tree.add(path) |
|
44 |
||
45 |
return
|
|
46 |
||
47 |
def ignore_cb(self, menu, vfs_file): |
|
48 |
# We can only cope with local files
|
|
49 |
if vfs_file.get_uri_scheme() != 'file': |
|
50 |
return
|
|
51 |
||
52 |
file = vfs_file.get_uri() |
|
53 |
try: |
|
54 |
tree, path = WorkingTree.open_containing(file) |
|
55 |
except NotBranchError: |
|
56 |
return
|
|
57 |
||
0.5.16
by Jelmer Vernooij
Adapt to bzr-gtk's API changes, add 'Clone' dialog |
58 |
#FIXME
|
59 |
||
0.5.4
by jbailey at ubuntu
Add 'add' function. Give framework for other callbacks. |
60 |
return
|
61 |
||
62 |
def unignore_cb(self, menu, vfs_file): |
|
63 |
# We can only cope with local files
|
|
64 |
if vfs_file.get_uri_scheme() != 'file': |
|
65 |
return
|
|
66 |
||
67 |
file = vfs_file.get_uri() |
|
68 |
try: |
|
69 |
tree, path = WorkingTree.open_containing(file) |
|
70 |
except NotBranchError: |
|
71 |
return
|
|
72 |
||
0.5.16
by Jelmer Vernooij
Adapt to bzr-gtk's API changes, add 'Clone' dialog |
73 |
#FIXME
|
74 |
||
0.5.4
by jbailey at ubuntu
Add 'add' function. Give framework for other callbacks. |
75 |
return
|
76 |
||
77 |
def diff_cb(self, menu, vfs_file): |
|
78 |
# We can only cope with local files
|
|
79 |
if vfs_file.get_uri_scheme() != 'file': |
|
80 |
return
|
|
81 |
||
82 |
file = vfs_file.get_uri() |
|
83 |
try: |
|
84 |
tree, path = WorkingTree.open_containing(file) |
|
85 |
except NotBranchError: |
|
86 |
return
|
|
87 |
||
419
by Szilveszter Farkas
Applied nautilus-bzr patches by Toshio Kuratomi. |
88 |
from bzrlib.plugins.gtk.diff import DiffWindow |
0.5.13
by Jelmer Vernooij
Use the gtk plugin rather than separate bzrk and gannotate |
89 |
window = DiffWindow() |
630
by Jelmer Vernooij
Use _get_nick(local=True) rather than .nick to get at a branches' nick, since |
90 |
window.set_diff(tree.branch._get_nick(local=True), tree, |
91 |
tree.branch.basis_tree()) |
|
0.5.13
by Jelmer Vernooij
Use the gtk plugin rather than separate bzrk and gannotate |
92 |
window.show() |
93 |
||
0.5.4
by jbailey at ubuntu
Add 'add' function. Give framework for other callbacks. |
94 |
return
|
95 |
||
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
96 |
def newtree_cb(self, menu, vfs_file): |
97 |
# We can only cope with local files
|
|
98 |
if vfs_file.get_uri_scheme() != 'file': |
|
99 |
return
|
|
100 |
||
101 |
file = vfs_file.get_uri() |
|
102 |
||
103 |
# We only want to continue here if we get a NotBranchError
|
|
104 |
try: |
|
105 |
tree, path = WorkingTree.open_containing(file) |
|
106 |
except NotBranchError: |
|
419
by Szilveszter Farkas
Applied nautilus-bzr patches by Toshio Kuratomi. |
107 |
BzrDir.create_standalone_workingtree(file) |
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
108 |
|
0.5.4
by jbailey at ubuntu
Add 'add' function. Give framework for other callbacks. |
109 |
def remove_cb(self, menu, vfs_file): |
110 |
# We can only cope with local files
|
|
111 |
if vfs_file.get_uri_scheme() != 'file': |
|
112 |
return
|
|
113 |
||
114 |
file = vfs_file.get_uri() |
|
115 |
try: |
|
116 |
tree, path = WorkingTree.open_containing(file) |
|
117 |
except NotBranchError: |
|
118 |
return
|
|
119 |
||
0.5.6
by jbailey at ubuntu
Implement remove |
120 |
tree.remove(path) |
121 |
||
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
122 |
def annotate_cb(self, menu, vfs_file): |
123 |
# We can only cope with local files
|
|
124 |
if vfs_file.get_uri_scheme() != 'file': |
|
125 |
return
|
|
126 |
||
127 |
file = vfs_file.get_uri() |
|
128 |
||
129 |
vis = cmd_gannotate() |
|
130 |
vis.run(file) |
|
0.5.16
by Jelmer Vernooij
Adapt to bzr-gtk's API changes, add 'Clone' dialog |
131 |
|
132 |
def clone_cb(self, menu, vfs_file=None): |
|
133 |
# We can only cope with local files
|
|
134 |
if vfs_file.get_uri_scheme() != 'file': |
|
135 |
return
|
|
136 |
||
142
by Jelmer Vernooij
Move some files to the top-level directory, add first test. |
137 |
from bzrlib.plugins.gtk.branch import BranchDialog |
90
by Jelmer Vernooij
Use Olive's clone dialog in nautilus-bzr; remove the old Clone dialog |
138 |
|
139 |
dialog = BranchDialog(vfs_file.get_name()) |
|
419
by Szilveszter Farkas
Applied nautilus-bzr patches by Toshio Kuratomi. |
140 |
response = dialog.run() |
141 |
if response != gtk.RESPONSE_NONE: |
|
142 |
dialog.hide() |
|
143 |
dialog.destroy() |
|
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
144 |
|
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
145 |
def commit_cb(self, menu, vfs_file=None): |
146 |
# We can only cope with local files
|
|
147 |
if vfs_file.get_uri_scheme() != 'file': |
|
148 |
return
|
|
149 |
||
150 |
file = vfs_file.get_uri() |
|
419
by Szilveszter Farkas
Applied nautilus-bzr patches by Toshio Kuratomi. |
151 |
tree = None |
152 |
branch = None |
|
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
153 |
try: |
154 |
tree, path = WorkingTree.open_containing(file) |
|
419
by Szilveszter Farkas
Applied nautilus-bzr patches by Toshio Kuratomi. |
155 |
branch = tree.branch |
156 |
except NotBranchError, e: |
|
157 |
path = e.path |
|
158 |
#return
|
|
159 |
except NoWorkingTree, e: |
|
160 |
path = e.base |
|
161 |
try: |
|
162 |
(branch, path) = Branch.open_containing(path) |
|
163 |
except NotBranchError, e: |
|
164 |
path = e.path |
|
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
165 |
|
142
by Jelmer Vernooij
Move some files to the top-level directory, add first test. |
166 |
from bzrlib.plugins.gtk.commit import CommitDialog |
423.13.4
by Jelmer Vernooij
Fix commit dialog from nautilus. |
167 |
dialog = CommitDialog(tree, path) |
419
by Szilveszter Farkas
Applied nautilus-bzr patches by Toshio Kuratomi. |
168 |
response = dialog.run() |
169 |
if response != gtk.RESPONSE_NONE: |
|
170 |
dialog.hide() |
|
171 |
dialog.destroy() |
|
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
172 |
|
0.5.12
by Jelmer Vernooij
Rename "Visualise Bazaar Branch" to "Log", which is a term |
173 |
def log_cb(self, menu, vfs_file): |
0.5.8
by jbailey at ubuntu
Add bzrk plugin |
174 |
# We can only cope with local files
|
175 |
if vfs_file.get_uri_scheme() != 'file': |
|
176 |
return
|
|
177 |
||
178 |
file = vfs_file.get_uri() |
|
179 |
||
180 |
# We only want to continue here if we get a NotBranchError
|
|
181 |
try: |
|
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
182 |
branch, path = Branch.open_containing(file) |
0.5.8
by jbailey at ubuntu
Add bzrk plugin |
183 |
except NotBranchError: |
184 |
return
|
|
185 |
||
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
186 |
pp = start_viz_window(branch, [branch.last_revision()]) |
187 |
pp.show() |
|
188 |
gtk.main() |
|
0.5.8
by jbailey at ubuntu
Add bzrk plugin |
189 |
|
91.1.4
by Jelmer Vernooij
List pull and merge in nautilus-bzr. |
190 |
def pull_cb(self, menu, vfs_file): |
191 |
# We can only cope with local files
|
|
192 |
if vfs_file.get_uri_scheme() != 'file': |
|
193 |
return
|
|
194 |
||
195 |
file = vfs_file.get_uri() |
|
196 |
||
197 |
# We only want to continue here if we get a NotBranchError
|
|
198 |
try: |
|
199 |
tree, path = WorkingTree.open_containing(file) |
|
200 |
except NotBranchError: |
|
201 |
return
|
|
202 |
||
142
by Jelmer Vernooij
Move some files to the top-level directory, add first test. |
203 |
from bzrlib.plugins.gtk.pull import PullDialog |
91.1.4
by Jelmer Vernooij
List pull and merge in nautilus-bzr. |
204 |
dialog = PullDialog(tree, path) |
205 |
dialog.display() |
|
206 |
gtk.main() |
|
207 |
||
208 |
def merge_cb(self, menu, vfs_file): |
|
209 |
# We can only cope with local files
|
|
210 |
if vfs_file.get_uri_scheme() != 'file': |
|
211 |
return
|
|
212 |
||
213 |
file = vfs_file.get_uri() |
|
214 |
||
215 |
# We only want to continue here if we get a NotBranchError
|
|
216 |
try: |
|
217 |
tree, path = WorkingTree.open_containing(file) |
|
218 |
except NotBranchError: |
|
219 |
return
|
|
220 |
||
142
by Jelmer Vernooij
Move some files to the top-level directory, add first test. |
221 |
from bzrlib.plugins.gtk.merge import MergeDialog |
91.1.4
by Jelmer Vernooij
List pull and merge in nautilus-bzr. |
222 |
dialog = MergeDialog(tree, path) |
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
223 |
dialog.run() |
578
by Jelmer Vernooij
Merge nautilus improvements. |
224 |
dialog.destroy() |
91.1.4
by Jelmer Vernooij
List pull and merge in nautilus-bzr. |
225 |
|
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
226 |
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 |
227 |
items = [] |
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
228 |
file = vfs_file.get_uri() |
455
by Martin Albisetti
Add enable/disable options to contexts menu |
229 |
|
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
230 |
try: |
231 |
tree, path = WorkingTree.open_containing(file) |
|
459
by Martin Albisetti
Change nautilus enable/disable to per branch basis |
232 |
disabled_flag = self.check_branch_enabled(tree.branch) |
419
by Szilveszter Farkas
Applied nautilus-bzr patches by Toshio Kuratomi. |
233 |
except UnsupportedProtocol: |
234 |
return
|
|
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
235 |
except NotBranchError: |
459
by Martin Albisetti
Change nautilus enable/disable to per branch basis |
236 |
disabled_flag = self.check_branch_enabled() |
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
237 |
item = nautilus.MenuItem('BzrNautilus::newtree', |
91
by Jelmer Vernooij
Some update to TODO. |
238 |
'Make directory versioned', |
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
239 |
'Create new Bazaar tree in this folder') |
240 |
item.connect('activate', self.newtree_cb, vfs_file) |
|
0.5.16
by Jelmer Vernooij
Adapt to bzr-gtk's API changes, add 'Clone' dialog |
241 |
items.append(item) |
242 |
||
243 |
item = nautilus.MenuItem('BzrNautilus::clone', |
|
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
244 |
'Checkout Bazaar branch ...', |
0.5.16
by Jelmer Vernooij
Adapt to bzr-gtk's API changes, add 'Clone' dialog |
245 |
'Checkout Existing Bazaar Branch') |
246 |
item.connect('activate', self.clone_cb, vfs_file) |
|
247 |
items.append(item) |
|
248 |
||
249 |
return items |
|
423.13.2
by Jelmer Vernooij
Fix handling of NoWorkingTree exception in a couple more places. |
250 |
except NoWorkingTree: |
251 |
return
|
|
459
by Martin Albisetti
Change nautilus enable/disable to per branch basis |
252 |
|
253 |
if disabled_flag == 'False': |
|
254 |
item = nautilus.MenuItem('BzrNautilus::enable', |
|
255 |
'Enable Bazaar Plugin for this Branch', |
|
256 |
'Enable Bazaar plugin for nautilus') |
|
460
by Martin Albisetti
Removed duplicate code |
257 |
item.connect('activate', self.toggle_integration, 'True', vfs_file) |
459
by Martin Albisetti
Change nautilus enable/disable to per branch basis |
258 |
return item, |
259 |
else: |
|
260 |
item = nautilus.MenuItem('BzrNautilus::disable', |
|
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
261 |
'Disable Bazaar Plugin this Branch', |
459
by Martin Albisetti
Change nautilus enable/disable to per branch basis |
262 |
'Disable Bazaar plugin for nautilus') |
460
by Martin Albisetti
Removed duplicate code |
263 |
item.connect('activate', self.toggle_integration, 'False', vfs_file) |
459
by Martin Albisetti
Change nautilus enable/disable to per branch basis |
264 |
items.append(item) |
0.5.8
by jbailey at ubuntu
Add bzrk plugin |
265 |
|
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
266 |
item = nautilus.MenuItem('BzrNautilus::log', |
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
267 |
'History ...', |
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
268 |
'Show Bazaar history') |
269 |
item.connect('activate', self.log_cb, vfs_file) |
|
270 |
items.append(item) |
|
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
271 |
|
91.1.4
by Jelmer Vernooij
List pull and merge in nautilus-bzr. |
272 |
item = nautilus.MenuItem('BzrNautilus::pull', |
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
273 |
'Pull ...', |
91.1.4
by Jelmer Vernooij
List pull and merge in nautilus-bzr. |
274 |
'Pull from another branch') |
275 |
item.connect('activate', self.pull_cb, vfs_file) |
|
276 |
items.append(item) |
|
277 |
||
278 |
item = nautilus.MenuItem('BzrNautilus::merge', |
|
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
279 |
'Merge ...', |
91.1.4
by Jelmer Vernooij
List pull and merge in nautilus-bzr. |
280 |
'Merge from another branch') |
281 |
item.connect('activate', self.merge_cb, vfs_file) |
|
282 |
items.append(item) |
|
283 |
||
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
284 |
item = nautilus.MenuItem('BzrNautilus::commit', |
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
285 |
'Commit ...', |
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
286 |
'Commit Changes') |
287 |
item.connect('activate', self.commit_cb, vfs_file) |
|
288 |
items.append(item) |
|
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
289 |
|
290 |
return items |
|
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
291 |
|
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
292 |
def get_file_items(self, window, files): |
293 |
items = [] |
|
459
by Martin Albisetti
Change nautilus enable/disable to per branch basis |
294 |
|
419
by Szilveszter Farkas
Applied nautilus-bzr patches by Toshio Kuratomi. |
295 |
wtfiles = {} |
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
296 |
for vfs_file in files: |
297 |
# We can only cope with local files
|
|
298 |
if vfs_file.get_uri_scheme() != 'file': |
|
423.13.2
by Jelmer Vernooij
Fix handling of NoWorkingTree exception in a couple more places. |
299 |
continue
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
300 |
|
301 |
file = vfs_file.get_uri() |
|
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
302 |
try: |
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
303 |
tree, path = WorkingTree.open_containing(file) |
459
by Martin Albisetti
Change nautilus enable/disable to per branch basis |
304 |
disabled_flag = self.check_branch_enabled(tree.branch) |
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
305 |
except NotBranchError: |
459
by Martin Albisetti
Change nautilus enable/disable to per branch basis |
306 |
disabled_flag = self.check_branch_enabled() |
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
307 |
if not vfs_file.is_directory(): |
423.13.2
by Jelmer Vernooij
Fix handling of NoWorkingTree exception in a couple more places. |
308 |
continue
|
459
by Martin Albisetti
Change nautilus enable/disable to per branch basis |
309 |
|
310 |
if disabled_flag == 'False': |
|
311 |
return
|
|
312 |
||
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
313 |
item = nautilus.MenuItem('BzrNautilus::newtree', |
91
by Jelmer Vernooij
Some update to TODO. |
314 |
'Make directory versioned', |
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
315 |
'Create new Bazaar tree in %s' % vfs_file.get_name()) |
316 |
item.connect('activate', self.newtree_cb, vfs_file) |
|
317 |
return item, |
|
423.13.2
by Jelmer Vernooij
Fix handling of NoWorkingTree exception in a couple more places. |
318 |
except NoWorkingTree: |
319 |
continue
|
|
419
by Szilveszter Farkas
Applied nautilus-bzr patches by Toshio Kuratomi. |
320 |
# Refresh the list of filestatuses in the working tree
|
321 |
if path not in wtfiles.keys(): |
|
322 |
tree.lock_read() |
|
323 |
for rpath, file_class, kind, id, entry in tree.list_files(): |
|
324 |
wtfiles[rpath] = file_class |
|
325 |
tree.unlock() |
|
326 |
wtfiles[u''] = 'V' |
|
327 |
||
328 |
if wtfiles[path] == '?': |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
329 |
item = nautilus.MenuItem('BzrNautilus::add', |
330 |
'Add', |
|
331 |
'Add as versioned file') |
|
332 |
item.connect('activate', self.add_cb, vfs_file) |
|
333 |
items.append(item) |
|
334 |
||
335 |
item = nautilus.MenuItem('BzrNautilus::ignore', |
|
336 |
'Ignore', |
|
337 |
'Ignore file for versioning') |
|
338 |
item.connect('activate', self.ignore_cb, vfs_file) |
|
339 |
items.append(item) |
|
419
by Szilveszter Farkas
Applied nautilus-bzr patches by Toshio Kuratomi. |
340 |
elif wtfiles[path] == 'I': |
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
341 |
item = nautilus.MenuItem('BzrNautilus::unignore', |
342 |
'Unignore', |
|
343 |
'Unignore file for versioning') |
|
344 |
item.connect('activate', self.unignore_cb, vfs_file) |
|
345 |
items.append(item) |
|
419
by Szilveszter Farkas
Applied nautilus-bzr patches by Toshio Kuratomi. |
346 |
elif wtfiles[path] == 'V': |
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
347 |
item = nautilus.MenuItem('BzrNautilus::log', |
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
348 |
'History ...', |
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
349 |
'List changes') |
350 |
item.connect('activate', self.log_cb, vfs_file) |
|
351 |
items.append(item) |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
352 |
|
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
353 |
item = nautilus.MenuItem('BzrNautilus::diff', |
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
354 |
'View Changes ...', |
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
355 |
'Show differences') |
356 |
item.connect('activate', self.diff_cb, vfs_file) |
|
357 |
items.append(item) |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
358 |
|
359 |
item = nautilus.MenuItem('BzrNautilus::remove', |
|
360 |
'Remove', |
|
361 |
'Remove this file from versioning') |
|
362 |
item.connect('activate', self.remove_cb, vfs_file) |
|
363 |
items.append(item) |
|
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
364 |
|
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
365 |
item = nautilus.MenuItem('BzrNautilus::annotate', |
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
366 |
'Annotate ...', |
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
367 |
'Annotate File Data') |
368 |
item.connect('activate', self.annotate_cb, vfs_file) |
|
369 |
items.append(item) |
|
370 |
||
371 |
item = nautilus.MenuItem('BzrNautilus::commit', |
|
576.2.1
by Jelmer Vernooij
Use ... notation for options that lead to dialogs, fix some nautilus-bzr menu items that had regressed. |
372 |
'Commit ...', |
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
373 |
'Commit Changes') |
374 |
item.connect('activate', self.commit_cb, vfs_file) |
|
375 |
items.append(item) |
|
376 |
||
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
377 |
return items |
88
by Jelmer Vernooij
Show column with file status. |
378 |
|
379 |
def get_columns(self): |
|
380 |
return nautilus.Column("BzrNautilus::bzr_status", |
|
381 |
"bzr_status", |
|
382 |
"Bzr Status", |
|
383 |
"Version control status"), |
|
384 |
||
385 |
def update_file_info(self, file): |
|
454
by Martin Albisetti
Add the logic to enable/disable the plugin |
386 |
|
88
by Jelmer Vernooij
Show column with file status. |
387 |
if file.get_uri_scheme() != 'file': |
388 |
return
|
|
389 |
||
390 |
try: |
|
391 |
tree, path = WorkingTree.open_containing(file.get_uri()) |
|
392 |
except NotBranchError: |
|
393 |
return
|
|
423.13.1
by Jelmer Vernooij
Fix handling of NoWorkingTree error. |
394 |
except NoWorkingTree: |
459
by Martin Albisetti
Change nautilus enable/disable to per branch basis |
395 |
return
|
396 |
||
397 |
disabled_flag = self.check_branch_enabled(tree.branch) |
|
398 |
if disabled_flag == 'False': |
|
423.13.1
by Jelmer Vernooij
Fix handling of NoWorkingTree error. |
399 |
return
|
88
by Jelmer Vernooij
Show column with file status. |
400 |
|
401 |
emblem = None |
|
402 |
status = None |
|
403 |
||
658.1.1
by Lucas Shrewsbury
Fix #294632 by adding ignored emblem and correct status. |
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): |
|
423.13.5
by Jelmer Vernooij
Change emblems to the new emblems submitted by Martin. |
413 |
emblem = 'bzr-controlled' |
88
by Jelmer Vernooij
Show column with file status. |
414 |
status = 'unchanged' |
415 |
||
416 |
delta = tree.changes_from(tree.branch.basis_tree()) |
|
417 |
if delta.touches_file_id(id): |
|
423.13.5
by Jelmer Vernooij
Change emblems to the new emblems submitted by Martin. |
418 |
emblem = 'bzr-modified' |
88
by Jelmer Vernooij
Show column with file status. |
419 |
status = 'modified' |
420 |
for f, _, _ in delta.added: |
|
421 |
if f == path: |
|
423.13.5
by Jelmer Vernooij
Change emblems to the new emblems submitted by Martin. |
422 |
emblem = 'bzr-added' |
88
by Jelmer Vernooij
Show column with file status. |
423 |
status = 'added' |
424 |
||
425 |
for of, f, _, _, _, _ in delta.renamed: |
|
426 |
if f == path: |
|
427 |
status = 'renamed from %s' % f |
|
428 |
||
429 |
elif tree.branch.basis_tree().has_filename(path): |
|
423.13.5
by Jelmer Vernooij
Change emblems to the new emblems submitted by Martin. |
430 |
emblem = 'bzr-removed' |
88
by Jelmer Vernooij
Show column with file status. |
431 |
status = 'removed' |
432 |
else: |
|
433 |
# FIXME: Check for ignored files
|
|
434 |
status = 'unversioned' |
|
435 |
||
436 |
if emblem is not None: |
|
437 |
file.add_emblem(emblem) |
|
438 |
file.add_string_attribute('bzr_status', status) |
|
454
by Martin Albisetti
Add the logic to enable/disable the plugin |
439 |
|
459
by Martin Albisetti
Change nautilus enable/disable to per branch basis |
440 |
def check_branch_enabled(self, branch=None): |
441 |
# Supports global disable, but there is currently no UI to do this
|
|
442 |
config = GlobalConfig() |
|
443 |
disabled_flag = config.get_user_option('nautilus_integration') |
|
444 |
if disabled_flag != 'False': |
|
445 |
if branch is not None: |
|
446 |
config = branch.get_config() |
|
447 |
disabled_flag = config.get_user_option('nautilus_integration') |
|
448 |
return disabled_flag |
|
449 |
||
460
by Martin Albisetti
Removed duplicate code |
450 |
def toggle_integration(self, menu, action, vfs_file=None): |
459
by Martin Albisetti
Change nautilus enable/disable to per branch basis |
451 |
try: |
452 |
tree, path = WorkingTree.open_containing(vfs_file.get_uri()) |
|
453 |
except NotBranchError: |
|
454 |
return
|
|
455 |
except NoWorkingTree: |
|
456 |
return
|
|
457 |
branch = tree.branch |
|
458 |
if branch is None: |
|
459 |
config = GlobalConfig() |
|
460 |
else: |
|
461 |
config = branch.get_config() |
|
460
by Martin Albisetti
Removed duplicate code |
462 |
config.set_user_option('nautilus_integration', action) |
454
by Martin Albisetti
Add the logic to enable/disable the plugin |
463 |