Merge lp:~jelmer/brz/move-registration into lp:brz
- move-registration
- Merge into trunk
Proposed by
Jelmer Vernooij
Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | no longer in the source branch. |
Merge reported by: | The Breezy Bot |
Merged at revision: | not available |
Proposed branch: | lp:~jelmer/brz/move-registration |
Merge into: | lp:brz |
Diff against target: |
1025 lines (+377/-366) 13 files modified
breezy/builtins.py (+1/-1) breezy/bzr/__init__.py (+336/-0) breezy/bzr/bzrdir.py (+1/-328) breezy/bzr/remote.py (+2/-1) breezy/bzr/smart/bzrdir.py (+3/-1) breezy/plugins/weave_fmt/__init__.py (+1/-1) breezy/tests/blackbox/test_exceptions.py (+2/-4) breezy/tests/blackbox/test_upgrade.py (+3/-2) breezy/tests/test_bzrdir.py (+10/-9) breezy/tests/test_options.py (+11/-13) breezy/tests/test_remote.py (+3/-1) breezy/tests/test_url_policy_open.py (+1/-1) tools/generate_docs.py (+3/-4) |
To merge this branch: | bzr merge lp:~jelmer/brz/move-registration |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Packman | Approve | ||
Review via email: mp+325703@code.launchpad.net |
Commit message
Move bzr format probing to breezy.bzr.
Description of the change
Move bzr format probing to breezy.bzr.
(This is to limit the amount of bzr-related code that needs to be imported when e.g. accessing non-bzr formats like git).
I'm planning to mirror this for the git support
To post a comment you must log in.
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
http://
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
http://
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
http://
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'breezy/builtins.py' |
2 | --- breezy/builtins.py 2017-06-15 22:34:55 +0000 |
3 | +++ breezy/builtins.py 2017-06-15 23:39:05 +0000 |
4 | @@ -22,7 +22,7 @@ |
5 | import os |
6 | import sys |
7 | |
8 | -import breezy.bzr.bzrdir |
9 | +import breezy.bzr |
10 | |
11 | from . import lazy_import |
12 | lazy_import.lazy_import(globals(), """ |
13 | |
14 | === modified file 'breezy/bzr/__init__.py' |
15 | --- breezy/bzr/__init__.py 2017-06-10 01:39:46 +0000 |
16 | +++ breezy/bzr/__init__.py 2017-06-15 23:39:05 +0000 |
17 | @@ -15,3 +15,339 @@ |
18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 | |
20 | from __future__ import absolute_import |
21 | + |
22 | +from .. import ( |
23 | + config, |
24 | + errors, |
25 | + controldir, |
26 | + pyutils, |
27 | + registry, |
28 | + ) |
29 | + |
30 | +class BzrProber(controldir.Prober): |
31 | + """Prober for formats that use a .bzr/ control directory.""" |
32 | + |
33 | + formats = registry.FormatRegistry(controldir.network_format_registry) |
34 | + """The known .bzr formats.""" |
35 | + |
36 | + @classmethod |
37 | + def probe_transport(klass, transport): |
38 | + """Return the .bzrdir style format present in a directory.""" |
39 | + try: |
40 | + format_string = transport.get_bytes(".bzr/branch-format") |
41 | + # GZ 2017-06-09: Where should format strings get decoded... |
42 | + format_text = format_string.decode("ascii") |
43 | + except errors.NoSuchFile: |
44 | + raise errors.NotBranchError(path=transport.base) |
45 | + try: |
46 | + first_line = format_text[:format_text.index("\n")+1] |
47 | + except ValueError: |
48 | + first_line = format_text |
49 | + try: |
50 | + cls = klass.formats.get(first_line) |
51 | + except KeyError: |
52 | + raise errors.UnknownFormatError(format=first_line, kind='bzrdir') |
53 | + return cls.from_string(format_text) |
54 | + |
55 | + @classmethod |
56 | + def known_formats(cls): |
57 | + result = set() |
58 | + for name, format in cls.formats.items(): |
59 | + if callable(format): |
60 | + format = format() |
61 | + result.add(format) |
62 | + return result |
63 | + |
64 | + |
65 | +controldir.ControlDirFormat.register_prober(BzrProber) |
66 | + |
67 | + |
68 | +class RemoteBzrProber(controldir.Prober): |
69 | + """Prober for remote servers that provide a Bazaar smart server.""" |
70 | + |
71 | + @classmethod |
72 | + def probe_transport(klass, transport): |
73 | + """Return a RemoteBzrDirFormat object if it looks possible.""" |
74 | + try: |
75 | + medium = transport.get_smart_medium() |
76 | + except (NotImplementedError, AttributeError, |
77 | + errors.TransportNotPossible, errors.NoSmartMedium, |
78 | + errors.SmartProtocolError): |
79 | + # no smart server, so not a branch for this format type. |
80 | + raise errors.NotBranchError(path=transport.base) |
81 | + else: |
82 | + # Decline to open it if the server doesn't support our required |
83 | + # version (3) so that the VFS-based transport will do it. |
84 | + if medium.should_probe(): |
85 | + try: |
86 | + server_version = medium.protocol_version() |
87 | + except errors.SmartProtocolError: |
88 | + # Apparently there's no usable smart server there, even though |
89 | + # the medium supports the smart protocol. |
90 | + raise errors.NotBranchError(path=transport.base) |
91 | + if server_version != '2': |
92 | + raise errors.NotBranchError(path=transport.base) |
93 | + from .remote import RemoteBzrDirFormat |
94 | + return RemoteBzrDirFormat() |
95 | + |
96 | + @classmethod |
97 | + def known_formats(cls): |
98 | + from .remote import RemoteBzrDirFormat |
99 | + return {RemoteBzrDirFormat()} |
100 | + |
101 | + |
102 | +controldir.ControlDirFormat.register_server_prober(RemoteBzrProber) |
103 | + |
104 | +# Register bzr formats |
105 | +BzrProber.formats.register_lazy( |
106 | + "Bazaar-NG meta directory, format 1\n", |
107 | + __name__ + '.bzrdir', 'BzrDirMetaFormat1') |
108 | +BzrProber.formats.register_lazy( |
109 | + "Bazaar meta directory, format 1 (with colocated branches)\n", |
110 | + __name__ + '.bzrdir', 'BzrDirMetaFormat1Colo') |
111 | + |
112 | + |
113 | +def register_metadir(registry, key, |
114 | + repository_format, help, native=True, deprecated=False, |
115 | + branch_format=None, |
116 | + tree_format=None, |
117 | + hidden=False, |
118 | + experimental=False, |
119 | + alias=False, bzrdir_format=None): |
120 | + """Register a metadir subformat. |
121 | + |
122 | + These all use a meta bzrdir, but can be parameterized by the |
123 | + Repository/Branch/WorkingTreeformats. |
124 | + |
125 | + :param repository_format: The fully-qualified repository format class |
126 | + name as a string. |
127 | + :param branch_format: Fully-qualified branch format class name as |
128 | + a string. |
129 | + :param tree_format: Fully-qualified tree format class name as |
130 | + a string. |
131 | + """ |
132 | + if bzrdir_format is None: |
133 | + bzrdir_format = 'breezy.bzr.bzrdir.BzrDirMetaFormat1' |
134 | + # This should be expanded to support setting WorkingTree and Branch |
135 | + # formats, once the API supports that. |
136 | + def _load(full_name): |
137 | + mod_name, factory_name = full_name.rsplit('.', 1) |
138 | + try: |
139 | + factory = pyutils.get_named_object(mod_name, factory_name) |
140 | + except ImportError as e: |
141 | + raise ImportError('failed to load %s: %s' % (full_name, e)) |
142 | + except AttributeError: |
143 | + raise AttributeError('no factory %s in module %r' |
144 | + % (full_name, sys.modules[mod_name])) |
145 | + return factory() |
146 | + |
147 | + def helper(): |
148 | + bd = _load(bzrdir_format) |
149 | + if branch_format is not None: |
150 | + bd.set_branch_format(_load(branch_format)) |
151 | + if tree_format is not None: |
152 | + bd.workingtree_format = _load(tree_format) |
153 | + if repository_format is not None: |
154 | + bd.repository_format = _load(repository_format) |
155 | + return bd |
156 | + registry.register(key, helper, help, native, deprecated, hidden, |
157 | + experimental, alias) |
158 | + |
159 | +register_metadir(controldir.format_registry, 'knit', |
160 | + 'breezy.bzr.knitrepo.RepositoryFormatKnit1', |
161 | + 'Format using knits. Recommended for interoperation with bzr <= 0.14.', |
162 | + branch_format='breezy.bzr.fullhistory.BzrBranchFormat5', |
163 | + tree_format='breezy.bzr.workingtree_3.WorkingTreeFormat3', |
164 | + hidden=True, |
165 | + deprecated=True) |
166 | +register_metadir(controldir.format_registry, 'dirstate', |
167 | + 'breezy.bzr.knitrepo.RepositoryFormatKnit1', |
168 | + help='Format using dirstate for working trees. ' |
169 | + 'Compatible with bzr 0.8 and ' |
170 | + 'above when accessed over the network. Introduced in bzr 0.15.', |
171 | + branch_format='breezy.bzr.fullhistory.BzrBranchFormat5', |
172 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
173 | + hidden=True, |
174 | + deprecated=True) |
175 | +register_metadir(controldir.format_registry, 'dirstate-tags', |
176 | + 'breezy.bzr.knitrepo.RepositoryFormatKnit1', |
177 | + help='Variant of dirstate with support for tags. ' |
178 | + 'Introduced in bzr 0.15.', |
179 | + branch_format='breezy.bzr.branch.BzrBranchFormat6', |
180 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
181 | + hidden=True, |
182 | + deprecated=True) |
183 | +register_metadir(controldir.format_registry, 'rich-root', |
184 | + 'breezy.bzr.knitrepo.RepositoryFormatKnit4', |
185 | + help='Variant of dirstate with better handling of tree roots. ' |
186 | + 'Introduced in bzr 1.0', |
187 | + branch_format='breezy.bzr.branch.BzrBranchFormat6', |
188 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
189 | + hidden=True, |
190 | + deprecated=True) |
191 | +register_metadir(controldir.format_registry, 'dirstate-with-subtree', |
192 | + 'breezy.bzr.knitrepo.RepositoryFormatKnit3', |
193 | + help='Variant of dirstate with support for nested trees. ' |
194 | + 'Introduced in 0.15.', |
195 | + branch_format='breezy.bzr.branch.BzrBranchFormat6', |
196 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
197 | + experimental=True, |
198 | + hidden=True, |
199 | + ) |
200 | +register_metadir(controldir.format_registry, 'pack-0.92', |
201 | + 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack1', |
202 | + help='Pack-based format used in 1.x series. Introduced in 0.92. ' |
203 | + 'Interoperates with bzr repositories before 0.92 but cannot be ' |
204 | + 'read by bzr < 0.92. ' |
205 | + , |
206 | + branch_format='breezy.bzr.branch.BzrBranchFormat6', |
207 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
208 | + deprecated=True, |
209 | + ) |
210 | +register_metadir(controldir.format_registry, 'pack-0.92-subtree', |
211 | + 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack3', |
212 | + help='Pack-based format used in 1.x series, with subtree support. ' |
213 | + 'Introduced in 0.92. Interoperates with ' |
214 | + 'bzr repositories before 0.92 but cannot be read by bzr < 0.92. ' |
215 | + , |
216 | + branch_format='breezy.bzr.branch.BzrBranchFormat6', |
217 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
218 | + hidden=True, |
219 | + deprecated=True, |
220 | + experimental=True, |
221 | + ) |
222 | +register_metadir(controldir.format_registry, 'rich-root-pack', |
223 | + 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack4', |
224 | + help='A variant of pack-0.92 that supports rich-root data ' |
225 | + '(needed for bzr-svn and bzr-git). Introduced in 1.0.', |
226 | + branch_format='breezy.bzr.branch.BzrBranchFormat6', |
227 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
228 | + hidden=True, |
229 | + deprecated=True, |
230 | + ) |
231 | +register_metadir(controldir.format_registry, '1.6', |
232 | + 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack5', |
233 | + help='A format that allows a branch to indicate that there is another ' |
234 | + '(stacked) repository that should be used to access data that is ' |
235 | + 'not present locally.', |
236 | + branch_format='breezy.bzr.branch.BzrBranchFormat7', |
237 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
238 | + hidden=True, |
239 | + deprecated=True, |
240 | + ) |
241 | +register_metadir(controldir.format_registry, '1.6.1-rich-root', |
242 | + 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack5RichRoot', |
243 | + help='A variant of 1.6 that supports rich-root data ' |
244 | + '(needed for bzr-svn and bzr-git).', |
245 | + branch_format='breezy.bzr.branch.BzrBranchFormat7', |
246 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
247 | + hidden=True, |
248 | + deprecated=True, |
249 | + ) |
250 | +register_metadir(controldir.format_registry, '1.9', |
251 | + 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack6', |
252 | + help='A repository format using B+tree indexes. These indexes ' |
253 | + 'are smaller in size, have smarter caching and provide faster ' |
254 | + 'performance for most operations.', |
255 | + branch_format='breezy.bzr.branch.BzrBranchFormat7', |
256 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
257 | + hidden=True, |
258 | + deprecated=True, |
259 | + ) |
260 | +register_metadir(controldir.format_registry, '1.9-rich-root', |
261 | + 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack6RichRoot', |
262 | + help='A variant of 1.9 that supports rich-root data ' |
263 | + '(needed for bzr-svn and bzr-git).', |
264 | + branch_format='breezy.bzr.branch.BzrBranchFormat7', |
265 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
266 | + hidden=True, |
267 | + deprecated=True, |
268 | + ) |
269 | +register_metadir(controldir.format_registry, '1.14', |
270 | + 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack6', |
271 | + help='A working-tree format that supports content filtering.', |
272 | + branch_format='breezy.bzr.branch.BzrBranchFormat7', |
273 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat5', |
274 | + hidden=True, |
275 | + deprecated=True, |
276 | + ) |
277 | +register_metadir(controldir.format_registry, '1.14-rich-root', |
278 | + 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack6RichRoot', |
279 | + help='A variant of 1.14 that supports rich-root data ' |
280 | + '(needed for bzr-svn and bzr-git).', |
281 | + branch_format='breezy.bzr.branch.BzrBranchFormat7', |
282 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat5', |
283 | + hidden=True, |
284 | + deprecated=True, |
285 | + ) |
286 | +# The following un-numbered 'development' formats should always just be aliases. |
287 | +register_metadir(controldir.format_registry, 'development-subtree', |
288 | + 'breezy.bzr.groupcompress_repo.RepositoryFormat2aSubtree', |
289 | + help='Current development format, subtree variant. Can convert data to and ' |
290 | + 'from pack-0.92-subtree (and anything compatible with ' |
291 | + 'pack-0.92-subtree) format repositories. Repositories and branches in ' |
292 | + 'this format can only be read by bzr.dev. Please read ' |
293 | + 'http://doc.bazaar.canonical.com/latest/developers/development-repo.html ' |
294 | + 'before use.', |
295 | + branch_format='breezy.bzr.branch.BzrBranchFormat7', |
296 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6', |
297 | + experimental=True, |
298 | + hidden=True, |
299 | + alias=False, # Restore to being an alias when an actual development subtree format is added |
300 | + # This current non-alias status is simply because we did not introduce a |
301 | + # chk based subtree format. |
302 | + ) |
303 | +register_metadir(controldir.format_registry, 'development5-subtree', |
304 | + 'breezy.bzr.knitpack_repo.RepositoryFormatPackDevelopment2Subtree', |
305 | + help='Development format, subtree variant. Can convert data to and ' |
306 | + 'from pack-0.92-subtree (and anything compatible with ' |
307 | + 'pack-0.92-subtree) format repositories. Repositories and branches in ' |
308 | + 'this format can only be read by bzr.dev. Please read ' |
309 | + 'http://doc.bazaar.canonical.com/latest/developers/development-repo.html ' |
310 | + 'before use.', |
311 | + branch_format='breezy.bzr.branch.BzrBranchFormat7', |
312 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6', |
313 | + experimental=True, |
314 | + hidden=True, |
315 | + alias=False, |
316 | + ) |
317 | + |
318 | +register_metadir(controldir.format_registry, 'development-colo', |
319 | + 'breezy.bzr.groupcompress_repo.RepositoryFormat2a', |
320 | + help='The 2a format with experimental support for colocated branches.\n', |
321 | + branch_format='breezy.bzr.branch.BzrBranchFormat7', |
322 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6', |
323 | + experimental=True, |
324 | + bzrdir_format='breezy.bzr.bzrdir.BzrDirMetaFormat1Colo', |
325 | + ) |
326 | + |
327 | + |
328 | +# And the development formats above will have aliased one of the following: |
329 | + |
330 | +# Finally, the current format. |
331 | +register_metadir(controldir.format_registry, '2a', |
332 | + 'breezy.bzr.groupcompress_repo.RepositoryFormat2a', |
333 | + help='Format for the bzr 2.0 series.\n' |
334 | + 'Uses group-compress storage.\n' |
335 | + 'Provides rich roots which are a one-way transition.\n', |
336 | + # 'storage in packs, 255-way hashed CHK inventory, bencode revision, group compress, ' |
337 | + # 'rich roots. Supported by bzr 1.16 and later.', |
338 | + branch_format='breezy.bzr.branch.BzrBranchFormat7', |
339 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6', |
340 | + experimental=False, |
341 | + ) |
342 | + |
343 | +# The following format should be an alias for the rich root equivalent |
344 | +# of the default format |
345 | +register_metadir(controldir.format_registry, 'default-rich-root', |
346 | + 'breezy.bzr.groupcompress_repo.RepositoryFormat2a', |
347 | + branch_format='breezy.bzr.branch.BzrBranchFormat7', |
348 | + tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6', |
349 | + alias=True, |
350 | + hidden=True, |
351 | + help='Same as 2a.') |
352 | + |
353 | + |
354 | +# The current format that is made on 'bzr init'. |
355 | +format_name = config.GlobalStack().get('default_format') |
356 | +controldir.format_registry.set_default(format_name) |
357 | |
358 | === modified file 'breezy/bzr/bzrdir.py' |
359 | --- breezy/bzr/bzrdir.py 2017-06-11 14:07:05 +0000 |
360 | +++ breezy/bzr/bzrdir.py 2017-06-15 23:39:05 +0000 |
361 | @@ -1223,78 +1223,6 @@ |
362 | self.features[name] = necessity |
363 | |
364 | |
365 | -class BzrProber(controldir.Prober): |
366 | - """Prober for formats that use a .bzr/ control directory.""" |
367 | - |
368 | - formats = registry.FormatRegistry(controldir.network_format_registry) |
369 | - """The known .bzr formats.""" |
370 | - |
371 | - @classmethod |
372 | - def probe_transport(klass, transport): |
373 | - """Return the .bzrdir style format present in a directory.""" |
374 | - try: |
375 | - format_string = transport.get_bytes(".bzr/branch-format") |
376 | - # GZ 2017-06-09: Where should format strings get decoded... |
377 | - format_text = format_string.decode("ascii") |
378 | - except errors.NoSuchFile: |
379 | - raise errors.NotBranchError(path=transport.base) |
380 | - try: |
381 | - first_line = format_text[:format_text.index("\n")+1] |
382 | - except ValueError: |
383 | - first_line = format_text |
384 | - try: |
385 | - cls = klass.formats.get(first_line) |
386 | - except KeyError: |
387 | - raise errors.UnknownFormatError(format=first_line, kind='bzrdir') |
388 | - return cls.from_string(format_text) |
389 | - |
390 | - @classmethod |
391 | - def known_formats(cls): |
392 | - result = set() |
393 | - for name, format in cls.formats.items(): |
394 | - if callable(format): |
395 | - format = format() |
396 | - result.add(format) |
397 | - return result |
398 | - |
399 | - |
400 | -controldir.ControlDirFormat.register_prober(BzrProber) |
401 | - |
402 | - |
403 | -class RemoteBzrProber(controldir.Prober): |
404 | - """Prober for remote servers that provide a Bazaar smart server.""" |
405 | - |
406 | - @classmethod |
407 | - def probe_transport(klass, transport): |
408 | - """Return a RemoteBzrDirFormat object if it looks possible.""" |
409 | - try: |
410 | - medium = transport.get_smart_medium() |
411 | - except (NotImplementedError, AttributeError, |
412 | - errors.TransportNotPossible, errors.NoSmartMedium, |
413 | - errors.SmartProtocolError): |
414 | - # no smart server, so not a branch for this format type. |
415 | - raise errors.NotBranchError(path=transport.base) |
416 | - else: |
417 | - # Decline to open it if the server doesn't support our required |
418 | - # version (3) so that the VFS-based transport will do it. |
419 | - if medium.should_probe(): |
420 | - try: |
421 | - server_version = medium.protocol_version() |
422 | - except errors.SmartProtocolError: |
423 | - # Apparently there's no usable smart server there, even though |
424 | - # the medium supports the smart protocol. |
425 | - raise errors.NotBranchError(path=transport.base) |
426 | - if server_version != '2': |
427 | - raise errors.NotBranchError(path=transport.base) |
428 | - from .remote import RemoteBzrDirFormat |
429 | - return RemoteBzrDirFormat() |
430 | - |
431 | - @classmethod |
432 | - def known_formats(cls): |
433 | - from .remote import RemoteBzrDirFormat |
434 | - return {RemoteBzrDirFormat()} |
435 | - |
436 | - |
437 | class BzrDirFormat(BzrFormat, controldir.ControlDirFormat): |
438 | """ControlDirFormat base class for .bzr/ directories. |
439 | |
440 | @@ -1745,12 +1673,6 @@ |
441 | __set_workingtree_format) |
442 | |
443 | |
444 | -# Register bzr formats |
445 | -BzrProber.formats.register(BzrDirMetaFormat1.get_format_string(), |
446 | - BzrDirMetaFormat1) |
447 | -controldir.ControlDirFormat._default_format = BzrDirMetaFormat1() |
448 | - |
449 | - |
450 | class BzrDirMetaFormat1Colo(BzrDirMetaFormat1): |
451 | """BzrDirMeta1 format with support for colocated branches.""" |
452 | |
453 | @@ -1775,10 +1697,6 @@ |
454 | return BzrDirMeta1(transport, format) |
455 | |
456 | |
457 | -BzrProber.formats.register(BzrDirMetaFormat1Colo.get_format_string(), |
458 | - BzrDirMetaFormat1Colo) |
459 | - |
460 | - |
461 | class ConvertMetaToMeta(controldir.Converter): |
462 | """Converts the components of metadirs.""" |
463 | |
464 | @@ -1892,9 +1810,6 @@ |
465 | return BzrDir.open_from_transport(to_convert.root_transport) |
466 | |
467 | |
468 | -controldir.ControlDirFormat.register_server_prober(RemoteBzrProber) |
469 | - |
470 | - |
471 | class RepositoryAcquisitionPolicy(object): |
472 | """Abstract base class for repository acquisition policies. |
473 | |
474 | @@ -2066,246 +1981,4 @@ |
475 | return self._repository, False |
476 | |
477 | |
478 | -def register_metadir(registry, key, |
479 | - repository_format, help, native=True, deprecated=False, |
480 | - branch_format=None, |
481 | - tree_format=None, |
482 | - hidden=False, |
483 | - experimental=False, |
484 | - alias=False, bzrdir_format=None): |
485 | - """Register a metadir subformat. |
486 | - |
487 | - These all use a meta bzrdir, but can be parameterized by the |
488 | - Repository/Branch/WorkingTreeformats. |
489 | - |
490 | - :param repository_format: The fully-qualified repository format class |
491 | - name as a string. |
492 | - :param branch_format: Fully-qualified branch format class name as |
493 | - a string. |
494 | - :param tree_format: Fully-qualified tree format class name as |
495 | - a string. |
496 | - """ |
497 | - if bzrdir_format is None: |
498 | - bzrdir_format = BzrDirMetaFormat1 |
499 | - # This should be expanded to support setting WorkingTree and Branch |
500 | - # formats, once the API supports that. |
501 | - def _load(full_name): |
502 | - mod_name, factory_name = full_name.rsplit('.', 1) |
503 | - try: |
504 | - factory = pyutils.get_named_object(mod_name, factory_name) |
505 | - except ImportError as e: |
506 | - raise ImportError('failed to load %s: %s' % (full_name, e)) |
507 | - except AttributeError: |
508 | - raise AttributeError('no factory %s in module %r' |
509 | - % (full_name, sys.modules[mod_name])) |
510 | - return factory() |
511 | - |
512 | - def helper(): |
513 | - bd = bzrdir_format() |
514 | - if branch_format is not None: |
515 | - bd.set_branch_format(_load(branch_format)) |
516 | - if tree_format is not None: |
517 | - bd.workingtree_format = _load(tree_format) |
518 | - if repository_format is not None: |
519 | - bd.repository_format = _load(repository_format) |
520 | - return bd |
521 | - registry.register(key, helper, help, native, deprecated, hidden, |
522 | - experimental, alias) |
523 | - |
524 | -register_metadir(controldir.format_registry, 'knit', |
525 | - 'breezy.bzr.knitrepo.RepositoryFormatKnit1', |
526 | - 'Format using knits. Recommended for interoperation with bzr <= 0.14.', |
527 | - branch_format='breezy.bzr.fullhistory.BzrBranchFormat5', |
528 | - tree_format='breezy.bzr.workingtree_3.WorkingTreeFormat3', |
529 | - hidden=True, |
530 | - deprecated=True) |
531 | -register_metadir(controldir.format_registry, 'dirstate', |
532 | - 'breezy.bzr.knitrepo.RepositoryFormatKnit1', |
533 | - help='Format using dirstate for working trees. ' |
534 | - 'Compatible with bzr 0.8 and ' |
535 | - 'above when accessed over the network. Introduced in bzr 0.15.', |
536 | - branch_format='breezy.bzr.fullhistory.BzrBranchFormat5', |
537 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
538 | - hidden=True, |
539 | - deprecated=True) |
540 | -register_metadir(controldir.format_registry, 'dirstate-tags', |
541 | - 'breezy.bzr.knitrepo.RepositoryFormatKnit1', |
542 | - help='Variant of dirstate with support for tags. ' |
543 | - 'Introduced in bzr 0.15.', |
544 | - branch_format='breezy.bzr.branch.BzrBranchFormat6', |
545 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
546 | - hidden=True, |
547 | - deprecated=True) |
548 | -register_metadir(controldir.format_registry, 'rich-root', |
549 | - 'breezy.bzr.knitrepo.RepositoryFormatKnit4', |
550 | - help='Variant of dirstate with better handling of tree roots. ' |
551 | - 'Introduced in bzr 1.0', |
552 | - branch_format='breezy.bzr.branch.BzrBranchFormat6', |
553 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
554 | - hidden=True, |
555 | - deprecated=True) |
556 | -register_metadir(controldir.format_registry, 'dirstate-with-subtree', |
557 | - 'breezy.bzr.knitrepo.RepositoryFormatKnit3', |
558 | - help='Variant of dirstate with support for nested trees. ' |
559 | - 'Introduced in 0.15.', |
560 | - branch_format='breezy.bzr.branch.BzrBranchFormat6', |
561 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
562 | - experimental=True, |
563 | - hidden=True, |
564 | - ) |
565 | -register_metadir(controldir.format_registry, 'pack-0.92', |
566 | - 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack1', |
567 | - help='Pack-based format used in 1.x series. Introduced in 0.92. ' |
568 | - 'Interoperates with bzr repositories before 0.92 but cannot be ' |
569 | - 'read by bzr < 0.92. ' |
570 | - , |
571 | - branch_format='breezy.bzr.branch.BzrBranchFormat6', |
572 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
573 | - deprecated=True, |
574 | - ) |
575 | -register_metadir(controldir.format_registry, 'pack-0.92-subtree', |
576 | - 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack3', |
577 | - help='Pack-based format used in 1.x series, with subtree support. ' |
578 | - 'Introduced in 0.92. Interoperates with ' |
579 | - 'bzr repositories before 0.92 but cannot be read by bzr < 0.92. ' |
580 | - , |
581 | - branch_format='breezy.bzr.branch.BzrBranchFormat6', |
582 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
583 | - hidden=True, |
584 | - deprecated=True, |
585 | - experimental=True, |
586 | - ) |
587 | -register_metadir(controldir.format_registry, 'rich-root-pack', |
588 | - 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack4', |
589 | - help='A variant of pack-0.92 that supports rich-root data ' |
590 | - '(needed for bzr-svn and bzr-git). Introduced in 1.0.', |
591 | - branch_format='breezy.bzr.branch.BzrBranchFormat6', |
592 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
593 | - hidden=True, |
594 | - deprecated=True, |
595 | - ) |
596 | -register_metadir(controldir.format_registry, '1.6', |
597 | - 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack5', |
598 | - help='A format that allows a branch to indicate that there is another ' |
599 | - '(stacked) repository that should be used to access data that is ' |
600 | - 'not present locally.', |
601 | - branch_format='breezy.bzr.branch.BzrBranchFormat7', |
602 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
603 | - hidden=True, |
604 | - deprecated=True, |
605 | - ) |
606 | -register_metadir(controldir.format_registry, '1.6.1-rich-root', |
607 | - 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack5RichRoot', |
608 | - help='A variant of 1.6 that supports rich-root data ' |
609 | - '(needed for bzr-svn and bzr-git).', |
610 | - branch_format='breezy.bzr.branch.BzrBranchFormat7', |
611 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
612 | - hidden=True, |
613 | - deprecated=True, |
614 | - ) |
615 | -register_metadir(controldir.format_registry, '1.9', |
616 | - 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack6', |
617 | - help='A repository format using B+tree indexes. These indexes ' |
618 | - 'are smaller in size, have smarter caching and provide faster ' |
619 | - 'performance for most operations.', |
620 | - branch_format='breezy.bzr.branch.BzrBranchFormat7', |
621 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
622 | - hidden=True, |
623 | - deprecated=True, |
624 | - ) |
625 | -register_metadir(controldir.format_registry, '1.9-rich-root', |
626 | - 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack6RichRoot', |
627 | - help='A variant of 1.9 that supports rich-root data ' |
628 | - '(needed for bzr-svn and bzr-git).', |
629 | - branch_format='breezy.bzr.branch.BzrBranchFormat7', |
630 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat4', |
631 | - hidden=True, |
632 | - deprecated=True, |
633 | - ) |
634 | -register_metadir(controldir.format_registry, '1.14', |
635 | - 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack6', |
636 | - help='A working-tree format that supports content filtering.', |
637 | - branch_format='breezy.bzr.branch.BzrBranchFormat7', |
638 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat5', |
639 | - hidden=True, |
640 | - deprecated=True, |
641 | - ) |
642 | -register_metadir(controldir.format_registry, '1.14-rich-root', |
643 | - 'breezy.bzr.knitpack_repo.RepositoryFormatKnitPack6RichRoot', |
644 | - help='A variant of 1.14 that supports rich-root data ' |
645 | - '(needed for bzr-svn and bzr-git).', |
646 | - branch_format='breezy.bzr.branch.BzrBranchFormat7', |
647 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat5', |
648 | - hidden=True, |
649 | - deprecated=True, |
650 | - ) |
651 | -# The following un-numbered 'development' formats should always just be aliases. |
652 | -register_metadir(controldir.format_registry, 'development-subtree', |
653 | - 'breezy.bzr.groupcompress_repo.RepositoryFormat2aSubtree', |
654 | - help='Current development format, subtree variant. Can convert data to and ' |
655 | - 'from pack-0.92-subtree (and anything compatible with ' |
656 | - 'pack-0.92-subtree) format repositories. Repositories and branches in ' |
657 | - 'this format can only be read by bzr.dev. Please read ' |
658 | - 'http://doc.bazaar.canonical.com/latest/developers/development-repo.html ' |
659 | - 'before use.', |
660 | - branch_format='breezy.bzr.branch.BzrBranchFormat7', |
661 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6', |
662 | - experimental=True, |
663 | - hidden=True, |
664 | - alias=False, # Restore to being an alias when an actual development subtree format is added |
665 | - # This current non-alias status is simply because we did not introduce a |
666 | - # chk based subtree format. |
667 | - ) |
668 | -register_metadir(controldir.format_registry, 'development5-subtree', |
669 | - 'breezy.bzr.knitpack_repo.RepositoryFormatPackDevelopment2Subtree', |
670 | - help='Development format, subtree variant. Can convert data to and ' |
671 | - 'from pack-0.92-subtree (and anything compatible with ' |
672 | - 'pack-0.92-subtree) format repositories. Repositories and branches in ' |
673 | - 'this format can only be read by bzr.dev. Please read ' |
674 | - 'http://doc.bazaar.canonical.com/latest/developers/development-repo.html ' |
675 | - 'before use.', |
676 | - branch_format='breezy.bzr.branch.BzrBranchFormat7', |
677 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6', |
678 | - experimental=True, |
679 | - hidden=True, |
680 | - alias=False, |
681 | - ) |
682 | - |
683 | -register_metadir(controldir.format_registry, 'development-colo', |
684 | - 'breezy.bzr.groupcompress_repo.RepositoryFormat2a', |
685 | - help='The 2a format with experimental support for colocated branches.\n', |
686 | - branch_format='breezy.bzr.branch.BzrBranchFormat7', |
687 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6', |
688 | - experimental=True, |
689 | - bzrdir_format=BzrDirMetaFormat1Colo, |
690 | - ) |
691 | - |
692 | - |
693 | -# And the development formats above will have aliased one of the following: |
694 | - |
695 | -# Finally, the current format. |
696 | -register_metadir(controldir.format_registry, '2a', |
697 | - 'breezy.bzr.groupcompress_repo.RepositoryFormat2a', |
698 | - help='Format for the bzr 2.0 series.\n' |
699 | - 'Uses group-compress storage.\n' |
700 | - 'Provides rich roots which are a one-way transition.\n', |
701 | - # 'storage in packs, 255-way hashed CHK inventory, bencode revision, group compress, ' |
702 | - # 'rich roots. Supported by bzr 1.16 and later.', |
703 | - branch_format='breezy.bzr.branch.BzrBranchFormat7', |
704 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6', |
705 | - experimental=False, |
706 | - ) |
707 | - |
708 | -# The following format should be an alias for the rich root equivalent |
709 | -# of the default format |
710 | -register_metadir(controldir.format_registry, 'default-rich-root', |
711 | - 'breezy.bzr.groupcompress_repo.RepositoryFormat2a', |
712 | - branch_format='breezy.bzr.branch.BzrBranchFormat7', |
713 | - tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6', |
714 | - alias=True, |
715 | - hidden=True, |
716 | - help='Same as 2a.') |
717 | - |
718 | -# The current format that is made on 'bzr init'. |
719 | -format_name = config.GlobalStack().get('default_format') |
720 | -controldir.format_registry.set_default(format_name) |
721 | +controldir.ControlDirFormat._default_format = BzrDirMetaFormat1() |
722 | |
723 | === modified file 'breezy/bzr/remote.py' |
724 | --- breezy/bzr/remote.py 2017-06-14 23:29:06 +0000 |
725 | +++ breezy/bzr/remote.py 2017-06-15 23:39:05 +0000 |
726 | @@ -22,6 +22,7 @@ |
727 | from .. import ( |
728 | bencode, |
729 | branch, |
730 | + bzr as _mod_bzr, |
731 | config as _mod_config, |
732 | controldir, |
733 | debug, |
734 | @@ -490,7 +491,7 @@ |
735 | warning('VFS BzrDir access triggered\n%s', |
736 | ''.join(traceback.format_stack())) |
737 | self._real_bzrdir = _mod_bzrdir.BzrDir.open_from_transport( |
738 | - self.root_transport, probers=[_mod_bzrdir.BzrProber]) |
739 | + self.root_transport, probers=[_mod_bzr.BzrProber]) |
740 | self._format._network_name = \ |
741 | self._real_bzrdir._format.network_name() |
742 | |
743 | |
744 | === modified file 'breezy/bzr/smart/bzrdir.py' |
745 | --- breezy/bzr/smart/bzrdir.py 2017-06-11 20:15:04 +0000 |
746 | +++ breezy/bzr/smart/bzrdir.py 2017-06-15 23:39:05 +0000 |
747 | @@ -25,10 +25,12 @@ |
748 | repository, |
749 | urlutils, |
750 | ) |
751 | +from .. import ( |
752 | + BzrProber, |
753 | + ) |
754 | from ..bzrdir import ( |
755 | BzrDir, |
756 | BzrDirFormat, |
757 | - BzrProber, |
758 | ) |
759 | from ...controldir import ( |
760 | network_format_registry, |
761 | |
762 | === modified file 'breezy/plugins/weave_fmt/__init__.py' |
763 | --- breezy/plugins/weave_fmt/__init__.py 2017-06-11 20:33:20 +0000 |
764 | +++ breezy/plugins/weave_fmt/__init__.py 2017-06-15 23:39:05 +0000 |
765 | @@ -33,7 +33,7 @@ |
766 | from ...bzr import ( |
767 | serializer, |
768 | ) |
769 | -from ...bzr.bzrdir import ( |
770 | +from ...bzr import ( |
771 | BzrProber, |
772 | register_metadir, |
773 | ) |
774 | |
775 | === modified file 'breezy/tests/blackbox/test_exceptions.py' |
776 | --- breezy/tests/blackbox/test_exceptions.py 2017-06-11 01:22:16 +0000 |
777 | +++ breezy/tests/blackbox/test_exceptions.py 2017-06-15 23:39:05 +0000 |
778 | @@ -20,6 +20,7 @@ |
779 | import re |
780 | |
781 | from breezy import ( |
782 | + bzr, |
783 | config, |
784 | controldir, |
785 | errors, |
786 | @@ -27,9 +28,6 @@ |
787 | repository, |
788 | tests, |
789 | ) |
790 | -from breezy.bzr import ( |
791 | - bzrdir, |
792 | - ) |
793 | from breezy.bzr.groupcompress_repo import RepositoryFormat2a |
794 | |
795 | |
796 | @@ -104,7 +102,7 @@ |
797 | TestObsoleteRepoFormat) |
798 | repository.format_registry.register(TestObsoleteRepoFormat) |
799 | self.addCleanup(controldir.format_registry.remove, "testobsolete") |
800 | - bzrdir.register_metadir(controldir.format_registry, "testobsolete", |
801 | + bzr.register_metadir(controldir.format_registry, "testobsolete", |
802 | "breezy.tests.blackbox.test_exceptions.TestObsoleteRepoFormat", |
803 | branch_format='breezy.bzr.branch.BzrBranchFormat7', |
804 | tree_format='breezy.bzr.workingtree_4.WorkingTreeFormat6', |
805 | |
806 | === modified file 'breezy/tests/blackbox/test_upgrade.py' |
807 | --- breezy/tests/blackbox/test_upgrade.py 2017-06-10 16:40:42 +0000 |
808 | +++ breezy/tests/blackbox/test_upgrade.py 2017-06-15 23:39:05 +0000 |
809 | @@ -19,6 +19,7 @@ |
810 | import stat |
811 | |
812 | from breezy import ( |
813 | + bzr, |
814 | controldir, |
815 | lockable_files, |
816 | ui, |
817 | @@ -130,9 +131,9 @@ |
818 | |
819 | def test_upgrade_control_dir(self): |
820 | old_format = OldBzrDirFormat() |
821 | - self.addCleanup(bzrdir.BzrProber.formats.remove, |
822 | + self.addCleanup(bzr.BzrProber.formats.remove, |
823 | old_format.get_format_string()) |
824 | - bzrdir.BzrProber.formats.register(old_format.get_format_string(), |
825 | + bzr.BzrProber.formats.register(old_format.get_format_string(), |
826 | old_format) |
827 | self.addCleanup(controldir.ControlDirFormat._set_default_format, |
828 | controldir.ControlDirFormat.get_default_format()) |
829 | |
830 | === modified file 'breezy/tests/test_bzrdir.py' |
831 | --- breezy/tests/test_bzrdir.py 2017-06-11 14:07:05 +0000 |
832 | +++ breezy/tests/test_bzrdir.py 2017-06-15 23:39:05 +0000 |
833 | @@ -25,6 +25,7 @@ |
834 | |
835 | from .. import ( |
836 | branch, |
837 | + bzr, |
838 | config, |
839 | controldir, |
840 | errors, |
841 | @@ -103,18 +104,18 @@ |
842 | my_format_registry.register_lazy('lazy', 'breezy.tests.test_bzrdir', |
843 | 'DeprecatedBzrDirFormat', 'Format registered lazily', |
844 | deprecated=True) |
845 | - bzrdir.register_metadir(my_format_registry, 'knit', |
846 | + bzr.register_metadir(my_format_registry, 'knit', |
847 | 'breezy.bzr.knitrepo.RepositoryFormatKnit1', |
848 | 'Format using knits', |
849 | ) |
850 | my_format_registry.set_default('knit') |
851 | - bzrdir.register_metadir(my_format_registry, |
852 | + bzr.register_metadir(my_format_registry, |
853 | 'branch6', |
854 | 'breezy.bzr.knitrepo.RepositoryFormatKnit3', |
855 | 'Experimental successor to knit. Use at your own risk.', |
856 | branch_format='breezy.bzr.branch.BzrBranchFormat6', |
857 | experimental=True) |
858 | - bzrdir.register_metadir(my_format_registry, |
859 | + bzr.register_metadir(my_format_registry, |
860 | 'hidden format', |
861 | 'breezy.bzr.knitrepo.RepositoryFormatKnit3', |
862 | 'Experimental successor to knit. Use at your own risk.', |
863 | @@ -281,13 +282,13 @@ |
864 | def test_find_format(self): |
865 | # is the right format object found for a branch? |
866 | # create a branch with a few known format objects. |
867 | - bzrdir.BzrProber.formats.register(BzrDirFormatTest1.get_format_string(), |
868 | + bzr.BzrProber.formats.register(BzrDirFormatTest1.get_format_string(), |
869 | BzrDirFormatTest1()) |
870 | - self.addCleanup(bzrdir.BzrProber.formats.remove, |
871 | + self.addCleanup(bzr.BzrProber.formats.remove, |
872 | BzrDirFormatTest1.get_format_string()) |
873 | - bzrdir.BzrProber.formats.register(BzrDirFormatTest2.get_format_string(), |
874 | + bzr.BzrProber.formats.register(BzrDirFormatTest2.get_format_string(), |
875 | BzrDirFormatTest2()) |
876 | - self.addCleanup(bzrdir.BzrProber.formats.remove, |
877 | + self.addCleanup(bzr.BzrProber.formats.remove, |
878 | BzrDirFormatTest2.get_format_string()) |
879 | t = self.get_transport() |
880 | self.build_tree(["foo/", "bar/"], transport=t) |
881 | @@ -318,7 +319,7 @@ |
882 | # make a bzrdir |
883 | format.initialize(url) |
884 | # register a format for it. |
885 | - bzrdir.BzrProber.formats.register(format.get_format_string(), format) |
886 | + bzr.BzrProber.formats.register(format.get_format_string(), format) |
887 | # which bzrdir.Open will refuse (not supported) |
888 | self.assertRaises(UnsupportedFormatError, bzrdir.BzrDir.open, url) |
889 | # which bzrdir.open_containing will refuse (not supported) |
890 | @@ -327,7 +328,7 @@ |
891 | t = _mod_transport.get_transport_from_url(url) |
892 | self.assertEqual(format.open(t), bzrdir.BzrDir.open_unsupported(url)) |
893 | # unregister the format |
894 | - bzrdir.BzrProber.formats.remove(format.get_format_string()) |
895 | + bzr.BzrProber.formats.remove(format.get_format_string()) |
896 | # now open_downlevel should fail too. |
897 | self.assertRaises(UnknownFormatError, bzrdir.BzrDir.open_unsupported, url) |
898 | |
899 | |
900 | === modified file 'breezy/tests/test_options.py' |
901 | --- breezy/tests/test_options.py 2017-06-10 16:40:42 +0000 |
902 | +++ breezy/tests/test_options.py 2017-06-15 23:39:05 +0000 |
903 | @@ -17,15 +17,13 @@ |
904 | import re |
905 | |
906 | from .. import ( |
907 | + bzr, |
908 | commands, |
909 | controldir, |
910 | errors, |
911 | option, |
912 | registry, |
913 | ) |
914 | -from ..bzr import ( |
915 | - bzrdir, |
916 | - ) |
917 | from ..builtins import cmd_commit |
918 | from ..commands import parse_args |
919 | from . import TestCase |
920 | @@ -120,9 +118,9 @@ |
921 | |
922 | def test_registry_conversion(self): |
923 | registry = controldir.ControlDirFormatRegistry() |
924 | - bzrdir.register_metadir(registry, 'one', 'RepositoryFormat7', 'one help') |
925 | - bzrdir.register_metadir(registry, 'two', 'RepositoryFormatKnit1', 'two help') |
926 | - bzrdir.register_metadir(registry, 'hidden', 'RepositoryFormatKnit1', |
927 | + bzr.register_metadir(registry, 'one', 'RepositoryFormat7', 'one help') |
928 | + bzr.register_metadir(registry, 'two', 'RepositoryFormatKnit1', 'two help') |
929 | + bzr.register_metadir(registry, 'hidden', 'RepositoryFormatKnit1', |
930 | 'two help', hidden=True) |
931 | registry.set_default('one') |
932 | options = [option.RegistryOption('format', '', registry, str)] |
933 | @@ -190,12 +188,12 @@ |
934 | |
935 | def test_help(self): |
936 | registry = controldir.ControlDirFormatRegistry() |
937 | - bzrdir.register_metadir(registry, 'one', 'RepositoryFormat7', 'one help') |
938 | - bzrdir.register_metadir(registry, 'two', |
939 | + bzr.register_metadir(registry, 'one', 'RepositoryFormat7', 'one help') |
940 | + bzr.register_metadir(registry, 'two', |
941 | 'breezy.bzr.knitrepo.RepositoryFormatKnit1', |
942 | 'two help', |
943 | ) |
944 | - bzrdir.register_metadir(registry, 'hidden', 'RepositoryFormat7', 'hidden help', |
945 | + bzr.register_metadir(registry, 'hidden', 'RepositoryFormat7', 'hidden help', |
946 | hidden=True) |
947 | registry.set_default('one') |
948 | options = [option.RegistryOption('format', 'format help', registry, |
949 | @@ -218,8 +216,8 @@ |
950 | self.assertEqual(list(opt.iter_switches()), |
951 | [('hello', None, 'GAR', 'fg')]) |
952 | registry = controldir.ControlDirFormatRegistry() |
953 | - bzrdir.register_metadir(registry, 'one', 'RepositoryFormat7', 'one help') |
954 | - bzrdir.register_metadir(registry, 'two', |
955 | + bzr.register_metadir(registry, 'one', 'RepositoryFormat7', 'one help') |
956 | + bzr.register_metadir(registry, 'two', |
957 | 'breezy.bzr.knitrepo.RepositoryFormatKnit1', |
958 | 'two help', |
959 | ) |
960 | @@ -379,9 +377,9 @@ |
961 | |
962 | def test_is_hidden(self): |
963 | registry = controldir.ControlDirFormatRegistry() |
964 | - bzrdir.register_metadir(registry, 'hidden', 'HiddenFormat', |
965 | + bzr.register_metadir(registry, 'hidden', 'HiddenFormat', |
966 | 'hidden help text', hidden=True) |
967 | - bzrdir.register_metadir(registry, 'visible', 'VisibleFormat', |
968 | + bzr.register_metadir(registry, 'visible', 'VisibleFormat', |
969 | 'visible help text', hidden=False) |
970 | format = option.RegistryOption('format', '', registry, str) |
971 | self.assertTrue(format.is_hidden('hidden')) |
972 | |
973 | === modified file 'breezy/tests/test_remote.py' |
974 | --- breezy/tests/test_remote.py 2017-06-11 20:15:04 +0000 |
975 | +++ breezy/tests/test_remote.py 2017-06-15 23:39:05 +0000 |
976 | @@ -49,6 +49,8 @@ |
977 | from ..bzr.bzrdir import ( |
978 | BzrDir, |
979 | BzrDirFormat, |
980 | + ) |
981 | +from ..bzr import ( |
982 | RemoteBzrProber, |
983 | ) |
984 | from ..bzr.chk_serializer import chk_bencode_serializer |
985 | @@ -127,7 +129,7 @@ |
986 | def test_find_correct_format(self): |
987 | """Should open a RemoteBzrDir over a RemoteTransport""" |
988 | fmt = BzrDirFormat.find_format(self.transport) |
989 | - self.assertTrue(bzrdir.RemoteBzrProber |
990 | + self.assertTrue(RemoteBzrProber |
991 | in controldir.ControlDirFormat._server_probers) |
992 | self.assertIsInstance(fmt, RemoteBzrDirFormat) |
993 | |
994 | |
995 | === modified file 'breezy/tests/test_url_policy_open.py' |
996 | --- breezy/tests/test_url_policy_open.py 2017-06-10 16:40:42 +0000 |
997 | +++ breezy/tests/test_url_policy_open.py 2017-06-15 23:39:05 +0000 |
998 | @@ -23,7 +23,7 @@ |
999 | from ..bzr.branch import ( |
1000 | BranchReferenceFormat, |
1001 | ) |
1002 | -from ..bzr.bzrdir import ( |
1003 | +from ..bzr import ( |
1004 | BzrProber, |
1005 | ) |
1006 | from ..controldir import ( |
1007 | |
1008 | === modified file 'tools/generate_docs.py' |
1009 | --- tools/generate_docs.py 2017-06-13 01:08:49 +0000 |
1010 | +++ tools/generate_docs.py 2017-06-15 23:39:05 +0000 |
1011 | @@ -38,12 +38,11 @@ |
1012 | |
1013 | sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) |
1014 | |
1015 | -import breezy |
1016 | +# Don't remove the following import, it triggers a format registration that |
1017 | +# avoid http://pad.lv/956860 |
1018 | +import breezy.bzr |
1019 | from breezy import ( |
1020 | commands, |
1021 | - # Don't remove the following import, it triggers a format registration that |
1022 | - # avoid http://pad.lv/956860 |
1023 | - branch, |
1024 | doc_generate, |
1025 | ) |
1026 |
Looks good, as all imports are from a level up rather than siblings.