bzr branch
http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
1 |
import nautilus |
2 |
import bzrlib |
|
3 |
from bzrlib.bzrdir import BzrDir |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
4 |
from bzrlib.errors import NotBranchError |
5 |
from bzrlib.workingtree import WorkingTree |
|
88
by Jelmer Vernooij
Show column with file status. |
6 |
from bzrlib.tree import file_status |
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
7 |
|
0.7.1
by Wouter van Heyst
use the bzrlib method of loading plugins, takes care of ~/.bazaar/plugins |
8 |
from bzrlib.plugin import load_plugins |
9 |
load_plugins() |
|
10 |
||
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
11 |
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 |
12 |
|
88
by Jelmer Vernooij
Show column with file status. |
13 |
class BzrExtension(nautilus.MenuProvider, nautilus.ColumnProvider, nautilus.InfoProvider): |
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
14 |
def __init__(self): |
15 |
pass
|
|
16 |
||
0.5.4
by jbailey at ubuntu
Add 'add' function. Give framework for other callbacks. |
17 |
def add_cb(self, menu, vfs_file): |
18 |
# We can only cope with local files
|
|
19 |
if vfs_file.get_uri_scheme() != 'file': |
|
20 |
return
|
|
21 |
||
22 |
file = vfs_file.get_uri() |
|
23 |
try: |
|
24 |
tree, path = WorkingTree.open_containing(file) |
|
25 |
except NotBranchError: |
|
26 |
return
|
|
27 |
||
28 |
tree.add(path) |
|
29 |
||
30 |
return
|
|
31 |
||
32 |
def ignore_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 |
||
0.5.16
by Jelmer Vernooij
Adapt to bzr-gtk's API changes, add 'Clone' dialog |
43 |
#FIXME
|
44 |
||
0.5.4
by jbailey at ubuntu
Add 'add' function. Give framework for other callbacks. |
45 |
return
|
46 |
||
47 |
def unignore_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 diff_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.13
by Jelmer Vernooij
Use the gtk plugin rather than separate bzrk and gannotate |
73 |
from bzrlib.plugins.gtk.viz.diffwin import DiffWindow |
74 |
window = DiffWindow() |
|
87
by Jelmer Vernooij
Fix diff window in nautilus. |
75 |
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 |
76 |
window.show() |
77 |
||
0.5.4
by jbailey at ubuntu
Add 'add' function. Give framework for other callbacks. |
78 |
return
|
79 |
||
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
80 |
def newtree_cb(self, menu, vfs_file): |
81 |
# We can only cope with local files
|
|
82 |
if vfs_file.get_uri_scheme() != 'file': |
|
83 |
return
|
|
84 |
||
85 |
file = vfs_file.get_uri() |
|
86 |
||
87 |
# We only want to continue here if we get a NotBranchError
|
|
88 |
try: |
|
89 |
tree, path = WorkingTree.open_containing(file) |
|
90 |
except NotBranchError: |
|
0.5.9
by jbailey at ubuntu
Implement repository creation |
91 |
BzrDir.create_branch_and_repo(file) |
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
92 |
|
0.5.4
by jbailey at ubuntu
Add 'add' function. Give framework for other callbacks. |
93 |
def remove_cb(self, menu, vfs_file): |
94 |
# We can only cope with local files
|
|
95 |
if vfs_file.get_uri_scheme() != 'file': |
|
96 |
return
|
|
97 |
||
98 |
file = vfs_file.get_uri() |
|
99 |
try: |
|
100 |
tree, path = WorkingTree.open_containing(file) |
|
101 |
except NotBranchError: |
|
102 |
return
|
|
103 |
||
0.5.6
by jbailey at ubuntu
Implement remove |
104 |
tree.remove(path) |
105 |
||
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
106 |
def annotate_cb(self, menu, vfs_file): |
107 |
# We can only cope with local files
|
|
108 |
if vfs_file.get_uri_scheme() != 'file': |
|
109 |
return
|
|
110 |
||
111 |
file = vfs_file.get_uri() |
|
112 |
||
113 |
vis = cmd_gannotate() |
|
114 |
vis.run(file) |
|
0.5.16
by Jelmer Vernooij
Adapt to bzr-gtk's API changes, add 'Clone' dialog |
115 |
|
116 |
def clone_cb(self, menu, vfs_file=None): |
|
117 |
# We can only cope with local files
|
|
118 |
if vfs_file.get_uri_scheme() != 'file': |
|
119 |
return
|
|
120 |
||
90
by Jelmer Vernooij
Use Olive's clone dialog in nautilus-bzr; remove the old Clone dialog |
121 |
from bzrlib.plugins.gtk.olive.branch import BranchDialog |
122 |
||
123 |
dialog = BranchDialog(vfs_file.get_name()) |
|
124 |
dialog.display() |
|
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
125 |
|
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
126 |
def commit_cb(self, menu, vfs_file=None): |
127 |
# We can only cope with local files
|
|
128 |
if vfs_file.get_uri_scheme() != 'file': |
|
129 |
return
|
|
130 |
||
131 |
file = vfs_file.get_uri() |
|
132 |
try: |
|
133 |
tree, path = WorkingTree.open_containing(file) |
|
134 |
except NotBranchError: |
|
135 |
return
|
|
136 |
||
90
by Jelmer Vernooij
Use Olive's clone dialog in nautilus-bzr; remove the old Clone dialog |
137 |
from bzrlib.plugins.gtk.olive.commit import CommitDialog |
138 |
dialog = CommitDialog(tree, path) |
|
139 |
dialog.display() |
|
140 |
gtk.main() |
|
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
141 |
|
0.5.12
by Jelmer Vernooij
Rename "Visualise Bazaar Branch" to "Log", which is a term |
142 |
def log_cb(self, menu, vfs_file): |
0.5.8
by jbailey at ubuntu
Add bzrk plugin |
143 |
# We can only cope with local files
|
144 |
if vfs_file.get_uri_scheme() != 'file': |
|
145 |
return
|
|
146 |
||
147 |
file = vfs_file.get_uri() |
|
148 |
||
149 |
# We only want to continue here if we get a NotBranchError
|
|
150 |
try: |
|
151 |
tree, path = WorkingTree.open_containing(file) |
|
152 |
except NotBranchError: |
|
153 |
return
|
|
154 |
||
155 |
vis = cmd_visualise() |
|
156 |
vis.run(file) |
|
157 |
||
158 |
return
|
|
159 |
||
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
160 |
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 |
161 |
items = [] |
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
162 |
file = vfs_file.get_uri() |
163 |
try: |
|
164 |
tree, path = WorkingTree.open_containing(file) |
|
165 |
except NotBranchError: |
|
166 |
item = nautilus.MenuItem('BzrNautilus::newtree', |
|
167 |
'Create new Bazaar tree', |
|
168 |
'Create new Bazaar tree in this folder') |
|
169 |
item.connect('activate', self.newtree_cb, vfs_file) |
|
0.5.16
by Jelmer Vernooij
Adapt to bzr-gtk's API changes, add 'Clone' dialog |
170 |
items.append(item) |
171 |
||
172 |
item = nautilus.MenuItem('BzrNautilus::clone', |
|
173 |
'Checkout', |
|
174 |
'Checkout Existing Bazaar Branch') |
|
175 |
item.connect('activate', self.clone_cb, vfs_file) |
|
176 |
items.append(item) |
|
177 |
||
178 |
return items |
|
0.5.8
by jbailey at ubuntu
Add bzrk plugin |
179 |
|
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
180 |
item = nautilus.MenuItem('BzrNautilus::log', |
181 |
'Log', |
|
182 |
'Show Bazaar history') |
|
183 |
item.connect('activate', self.log_cb, vfs_file) |
|
184 |
items.append(item) |
|
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
185 |
|
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
186 |
item = nautilus.MenuItem('BzrNautilus::commit', |
187 |
'Commit', |
|
188 |
'Commit Changes') |
|
189 |
item.connect('activate', self.commit_cb, vfs_file) |
|
190 |
items.append(item) |
|
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
191 |
|
192 |
return items |
|
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
193 |
|
194 |
||
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
195 |
def get_file_items(self, window, files): |
196 |
items = [] |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
197 |
|
198 |
for vfs_file in files: |
|
199 |
# We can only cope with local files
|
|
200 |
if vfs_file.get_uri_scheme() != 'file': |
|
201 |
return
|
|
202 |
||
203 |
file = vfs_file.get_uri() |
|
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
204 |
try: |
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
205 |
tree, path = WorkingTree.open_containing(file) |
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
206 |
except NotBranchError: |
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
207 |
if not vfs_file.is_directory(): |
208 |
return
|
|
209 |
item = nautilus.MenuItem('BzrNautilus::newtree', |
|
210 |
'Create new Bazaar tree', |
|
211 |
'Create new Bazaar tree in %s' % vfs_file.get_name()) |
|
212 |
item.connect('activate', self.newtree_cb, vfs_file) |
|
213 |
return item, |
|
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
214 |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
215 |
file_class = tree.file_class(path) |
216 |
||
217 |
if file_class == '?': |
|
218 |
item = nautilus.MenuItem('BzrNautilus::add', |
|
219 |
'Add', |
|
220 |
'Add as versioned file') |
|
221 |
item.connect('activate', self.add_cb, vfs_file) |
|
222 |
items.append(item) |
|
223 |
||
224 |
item = nautilus.MenuItem('BzrNautilus::ignore', |
|
225 |
'Ignore', |
|
226 |
'Ignore file for versioning') |
|
227 |
item.connect('activate', self.ignore_cb, vfs_file) |
|
228 |
items.append(item) |
|
229 |
elif file_class == 'I': |
|
230 |
item = nautilus.MenuItem('BzrNautilus::unignore', |
|
231 |
'Unignore', |
|
232 |
'Unignore file for versioning') |
|
233 |
item.connect('activate', self.unignore_cb, vfs_file) |
|
234 |
items.append(item) |
|
235 |
elif file_class == 'V': |
|
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
236 |
item = nautilus.MenuItem('BzrNautilus::log', |
237 |
'Log', |
|
238 |
'List changes') |
|
239 |
item.connect('activate', self.log_cb, vfs_file) |
|
240 |
items.append(item) |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
241 |
|
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
242 |
item = nautilus.MenuItem('BzrNautilus::diff', |
243 |
'Diff', |
|
244 |
'Show differences') |
|
245 |
item.connect('activate', self.diff_cb, vfs_file) |
|
246 |
items.append(item) |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
247 |
|
248 |
item = nautilus.MenuItem('BzrNautilus::remove', |
|
249 |
'Remove', |
|
250 |
'Remove this file from versioning') |
|
251 |
item.connect('activate', self.remove_cb, vfs_file) |
|
252 |
items.append(item) |
|
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
253 |
|
81
by Jelmer Vernooij
Remove unnecessary "#!/usr/bin/python" shebang lines (fixes #59125). |
254 |
item = nautilus.MenuItem('BzrNautilus::annotate', |
255 |
'Annotate', |
|
256 |
'Annotate File Data') |
|
257 |
item.connect('activate', self.annotate_cb, vfs_file) |
|
258 |
items.append(item) |
|
259 |
||
260 |
item = nautilus.MenuItem('BzrNautilus::commit', |
|
261 |
'Commit', |
|
262 |
'Commit Changes') |
|
263 |
item.connect('activate', self.commit_cb, vfs_file) |
|
264 |
items.append(item) |
|
265 |
||
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
266 |
return items |
88
by Jelmer Vernooij
Show column with file status. |
267 |
|
268 |
def get_columns(self): |
|
269 |
return nautilus.Column("BzrNautilus::bzr_status", |
|
270 |
"bzr_status", |
|
271 |
"Bzr Status", |
|
272 |
"Version control status"), |
|
273 |
||
274 |
def update_file_info(self, file): |
|
275 |
if file.get_uri_scheme() != 'file': |
|
276 |
return
|
|
277 |
||
278 |
try: |
|
279 |
tree, path = WorkingTree.open_containing(file.get_uri()) |
|
280 |
except NotBranchError: |
|
281 |
return
|
|
282 |
||
283 |
emblem = None |
|
284 |
status = None |
|
285 |
||
286 |
if tree.has_filename(path): |
|
287 |
emblem = 'cvs-controlled' |
|
288 |
status = 'unchanged' |
|
289 |
id = tree.path2id(path) |
|
290 |
||
291 |
delta = tree.changes_from(tree.branch.basis_tree()) |
|
292 |
if delta.touches_file_id(id): |
|
293 |
emblem = 'cvs-modified' |
|
294 |
status = 'modified' |
|
295 |
for f, _, _ in delta.added: |
|
296 |
if f == path: |
|
297 |
emblem = 'cvs-added' |
|
298 |
status = 'added' |
|
299 |
||
300 |
for of, f, _, _, _, _ in delta.renamed: |
|
301 |
if f == path: |
|
302 |
status = 'renamed from %s' % f |
|
303 |
||
304 |
elif tree.branch.basis_tree().has_filename(path): |
|
305 |
emblem = 'cvs-removed' |
|
306 |
status = 'removed' |
|
307 |
else: |
|
308 |
# FIXME: Check for ignored files
|
|
309 |
status = 'unversioned' |
|
310 |
||
311 |
if emblem is not None: |
|
312 |
file.add_emblem(emblem) |
|
313 |
file.add_string_attribute('bzr_status', status) |