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 |
|
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
6 |
|
0.7.1
by Wouter van Heyst
use the bzrlib method of loading plugins, takes care of ~/.bazaar/plugins |
7 |
from bzrlib.plugin import load_plugins |
8 |
load_plugins() |
|
9 |
||
0.5.8
by jbailey at ubuntu
Add bzrk plugin |
10 |
try: |
0.5.13
by Jelmer Vernooij
Use the gtk plugin rather than separate bzrk and gannotate |
11 |
from bzrlib.plugins.gtk.viz import cmd_visualise |
12 |
from bzrlib.plugins.gtk.annotate import cmd_gannotate |
|
13 |
have_gtkplugin = True |
|
14 |
except ImportError: |
|
15 |
have_gtkplugin = False |
|
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
16 |
|
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
17 |
class BzrExtension(nautilus.MenuProvider): |
18 |
def __init__(self): |
|
19 |
pass
|
|
20 |
||
0.5.4
by jbailey at ubuntu
Add 'add' function. Give framework for other callbacks. |
21 |
def add_cb(self, menu, vfs_file): |
22 |
# We can only cope with local files
|
|
23 |
if vfs_file.get_uri_scheme() != 'file': |
|
24 |
return
|
|
25 |
||
26 |
file = vfs_file.get_uri() |
|
27 |
try: |
|
28 |
tree, path = WorkingTree.open_containing(file) |
|
29 |
except NotBranchError: |
|
30 |
return
|
|
31 |
||
32 |
tree.add(path) |
|
33 |
||
34 |
return
|
|
35 |
||
36 |
def ignore_cb(self, menu, vfs_file): |
|
37 |
# We can only cope with local files
|
|
38 |
if vfs_file.get_uri_scheme() != 'file': |
|
39 |
return
|
|
40 |
||
41 |
file = vfs_file.get_uri() |
|
42 |
try: |
|
43 |
tree, path = WorkingTree.open_containing(file) |
|
44 |
except NotBranchError: |
|
45 |
return
|
|
46 |
||
47 |
return
|
|
48 |
||
49 |
def unignore_cb(self, menu, vfs_file): |
|
50 |
# We can only cope with local files
|
|
51 |
if vfs_file.get_uri_scheme() != 'file': |
|
52 |
return
|
|
53 |
||
54 |
file = vfs_file.get_uri() |
|
55 |
try: |
|
56 |
tree, path = WorkingTree.open_containing(file) |
|
57 |
except NotBranchError: |
|
58 |
return
|
|
59 |
||
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() |
|
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
75 |
window.set_diff(tree.branch, tree, tree.branch.revision_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 |
return
|
93 |
||
94 |
return
|
|
95 |
||
0.5.4
by jbailey at ubuntu
Add 'add' function. Give framework for other callbacks. |
96 |
def remove_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 |
try: |
|
103 |
tree, path = WorkingTree.open_containing(file) |
|
104 |
except NotBranchError: |
|
105 |
return
|
|
106 |
||
0.5.6
by jbailey at ubuntu
Implement remove |
107 |
tree.remove(path) |
108 |
||
0.5.4
by jbailey at ubuntu
Add 'add' function. Give framework for other callbacks. |
109 |
return
|
110 |
||
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
111 |
def annotate_cb(self, menu, vfs_file): |
112 |
# We can only cope with local files
|
|
113 |
if vfs_file.get_uri_scheme() != 'file': |
|
114 |
return
|
|
115 |
||
116 |
file = vfs_file.get_uri() |
|
117 |
||
118 |
vis = cmd_gannotate() |
|
119 |
vis.run(file) |
|
120 |
||
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
121 |
def commit_cb(self, menu, vfs_file=None): |
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 |
try: |
|
128 |
tree, path = WorkingTree.open_containing(file) |
|
129 |
except NotBranchError: |
|
130 |
return
|
|
131 |
||
132 |
from bzrlib.plugins.gtk.commit.gcommit import GCommitDialog |
|
133 |
dialog = GCommitDialog(tree) |
|
134 |
dialog.set_title(path + " - Commit") |
|
135 |
if dialog.run() != gtk.RESPONSE_CANCEL: |
|
136 |
Commit().commit(working_tree=wt,message=dialog.message, |
|
137 |
specific_files=dialog.specific_files) |
|
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
138 |
|
0.5.12
by Jelmer Vernooij
Rename "Visualise Bazaar Branch" to "Log", which is a term |
139 |
def log_cb(self, menu, vfs_file): |
0.5.8
by jbailey at ubuntu
Add bzrk plugin |
140 |
# We can only cope with local files
|
141 |
if vfs_file.get_uri_scheme() != 'file': |
|
142 |
return
|
|
143 |
||
144 |
file = vfs_file.get_uri() |
|
145 |
||
146 |
# We only want to continue here if we get a NotBranchError
|
|
147 |
try: |
|
148 |
tree, path = WorkingTree.open_containing(file) |
|
149 |
except NotBranchError: |
|
150 |
return
|
|
151 |
||
152 |
vis = cmd_visualise() |
|
153 |
vis.run(file) |
|
154 |
||
155 |
return
|
|
156 |
||
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
157 |
def get_background_items(self, window, vfs_file): |
158 |
file = vfs_file.get_uri() |
|
159 |
try: |
|
160 |
tree, path = WorkingTree.open_containing(file) |
|
161 |
except NotBranchError: |
|
162 |
item = nautilus.MenuItem('BzrNautilus::newtree', |
|
163 |
'Create new Bazaar tree', |
|
164 |
'Create new Bazaar tree in this folder') |
|
165 |
item.connect('activate', self.newtree_cb, vfs_file) |
|
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
166 |
return item |
0.5.8
by jbailey at ubuntu
Add bzrk plugin |
167 |
|
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
168 |
items = [] |
0.5.13
by Jelmer Vernooij
Use the gtk plugin rather than separate bzrk and gannotate |
169 |
if have_gtkplugin: |
0.5.12
by Jelmer Vernooij
Rename "Visualise Bazaar Branch" to "Log", which is a term |
170 |
item = nautilus.MenuItem('BzrNautilus::log', |
171 |
'Log', |
|
172 |
'Show Bazaar history') |
|
173 |
item.connect('activate', self.log_cb, vfs_file) |
|
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
174 |
items.append(item) |
175 |
||
176 |
item = nautilus.MenuItem('BzrNautilus::commit', |
|
177 |
'Commit', |
|
178 |
'Commit Changes') |
|
179 |
item.connect('activate', self.commit_cb, vfs_file) |
|
180 |
items.append(item) |
|
181 |
||
182 |
return items |
|
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
183 |
|
184 |
||
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
185 |
def get_file_items(self, window, files): |
186 |
items = [] |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
187 |
|
188 |
for vfs_file in files: |
|
189 |
# We can only cope with local files
|
|
190 |
if vfs_file.get_uri_scheme() != 'file': |
|
191 |
return
|
|
192 |
||
193 |
file = vfs_file.get_uri() |
|
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
194 |
try: |
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
195 |
tree, path = WorkingTree.open_containing(file) |
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
196 |
except NotBranchError: |
0.5.7
by jbailey at ubuntu
Add hook for creating new bzr trees. |
197 |
if not vfs_file.is_directory(): |
198 |
return
|
|
199 |
item = nautilus.MenuItem('BzrNautilus::newtree', |
|
200 |
'Create new Bazaar tree', |
|
201 |
'Create new Bazaar tree in %s' % vfs_file.get_name()) |
|
202 |
item.connect('activate', self.newtree_cb, vfs_file) |
|
203 |
return item, |
|
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
204 |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
205 |
file_class = tree.file_class(path) |
206 |
||
207 |
if file_class == '?': |
|
208 |
item = nautilus.MenuItem('BzrNautilus::add', |
|
209 |
'Add', |
|
210 |
'Add as versioned file') |
|
211 |
item.connect('activate', self.add_cb, vfs_file) |
|
212 |
items.append(item) |
|
213 |
||
214 |
item = nautilus.MenuItem('BzrNautilus::ignore', |
|
215 |
'Ignore', |
|
216 |
'Ignore file for versioning') |
|
217 |
item.connect('activate', self.ignore_cb, vfs_file) |
|
218 |
items.append(item) |
|
219 |
elif file_class == 'I': |
|
220 |
item = nautilus.MenuItem('BzrNautilus::unignore', |
|
221 |
'Unignore', |
|
222 |
'Unignore file for versioning') |
|
223 |
item.connect('activate', self.unignore_cb, vfs_file) |
|
224 |
items.append(item) |
|
225 |
elif file_class == 'V': |
|
0.5.13
by Jelmer Vernooij
Use the gtk plugin rather than separate bzrk and gannotate |
226 |
if have_gtkplugin: |
227 |
item = nautilus.MenuItem('BzrNautilus::log', |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
228 |
'Log', |
229 |
'List changes') |
|
0.5.13
by Jelmer Vernooij
Use the gtk plugin rather than separate bzrk and gannotate |
230 |
item.connect('activate', self.log_cb, vfs_file) |
231 |
items.append(item) |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
232 |
|
0.5.13
by Jelmer Vernooij
Use the gtk plugin rather than separate bzrk and gannotate |
233 |
item = nautilus.MenuItem('BzrNautilus::diff', |
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
234 |
'Diff', |
235 |
'Show differences') |
|
0.5.13
by Jelmer Vernooij
Use the gtk plugin rather than separate bzrk and gannotate |
236 |
item.connect('activate', self.diff_cb, vfs_file) |
237 |
items.append(item) |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
238 |
|
239 |
item = nautilus.MenuItem('BzrNautilus::remove', |
|
240 |
'Remove', |
|
241 |
'Remove this file from versioning') |
|
242 |
item.connect('activate', self.remove_cb, vfs_file) |
|
243 |
items.append(item) |
|
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
244 |
|
0.5.13
by Jelmer Vernooij
Use the gtk plugin rather than separate bzrk and gannotate |
245 |
if have_gtkplugin: |
0.6.2
by Jelmer Vernooij
Add 'Annotate' menu entry that uses the gannotate bzr plugin |
246 |
item = nautilus.MenuItem('BzrNautilus::annotate', |
247 |
'Annotate', |
|
248 |
'Annotate File Data') |
|
249 |
item.connect('activate', self.annotate_cb, vfs_file) |
|
250 |
items.append(item) |
|
0.5.15
by Jelmer Vernooij
Add 'Commit' entries |
251 |
|
252 |
item = nautilus.MenuItem('BzrNautilus::commit', |
|
253 |
'Commit', |
|
254 |
'Commit Changes') |
|
255 |
item.connect('activate', self.commit_cb, vfs_file) |
|
256 |
items.append(item) |
|
0.5.2
by jbailey at ubuntu
Bring this to a state where it actually works. Specifically: |
257 |
|
0.5.1
by Jelmer Vernooij
Start working on bzr integration plugin for nautilus |
258 |
return items |