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