Status: | Merged |
---|---|
Approved by: | Vincent Ladeuil |
Approved revision: | no longer in the source branch. |
Merged at revision: | 6535 |
Proposed branch: | lp:~jelmer/bzr/branchfmt |
Merge into: | lp:bzr |
Diff against target: |
546 lines (+223/-153) 10 files modified
bzrlib/branch.py (+2/-141) bzrlib/branchfmt/__init__.py (+25/-0) bzrlib/branchfmt/fullhistory.py (+178/-0) bzrlib/bzrdir.py (+4/-3) bzrlib/plugins/weave_fmt/__init__.py (+1/-1) bzrlib/plugins/weave_fmt/branch.py (+2/-0) bzrlib/plugins/weave_fmt/bzrdir.py (+1/-1) bzrlib/tests/per_repository/test_repository.py (+1/-1) bzrlib/tests/test_branch.py (+7/-4) bzrlib/tests/test_bzrdir.py (+2/-2) |
To merge this branch: | bzr merge lp:~jelmer/bzr/branchfmt |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Vincent Ladeuil | Approve | ||
Review via email: mp+100220@code.launchpad.net |
Commit message
Move the old branch format 5 into a separate module.
Description of the change
Move the old branch format 5 into a separate module.
Jelmer Vernooij (jelmer) wrote : | # |
> I'm not sure I understand the purpose of the proposal here, it seems like a
> step towards... something I can't put my finger on ;)
>
> Should branchfmt be named branch_
No, as I can imagine us moving other branch formats in there in the future as well.
> If not, what kind of modules will be added there ? When ?
I would imagine adding new formats there in the future if we have a good reason to. We could add the existing formats there too, e.g. in bzrlib.
> No objection per se but I've got the feeling we don't use the right names here
> nor put this code in the right place.
>
> I think I would feel more comfortable if this code could be handled in the
> same way the weave code was but if it's too early for that may be we should
> just wait.
The weave branch format already lives in bzrlib/
Vincent Ladeuil (vila) wrote : | # |
Ok, so, please remove the hideous '.THIS' file for good, add a summary of your comments above (and the additional ones you made on IRC) into bzrlib/
Preview Diff
1 | === modified file 'bzrlib/branch.py' |
2 | --- bzrlib/branch.py 2012-06-30 06:34:22 +0000 |
3 | +++ bzrlib/branch.py 2012-07-06 17:08:19 +0000 |
4 | @@ -2039,45 +2039,6 @@ |
5 | recommend_upgrade=recommend_upgrade, basedir=basedir) |
6 | |
7 | |
8 | -class BzrBranchFormat5(BranchFormatMetadir): |
9 | - """Bzr branch format 5. |
10 | - |
11 | - This format has: |
12 | - - a revision-history file. |
13 | - - a format string |
14 | - - a lock dir guarding the branch itself |
15 | - - all of this stored in a branch/ subdirectory |
16 | - - works with shared repositories. |
17 | - |
18 | - This format is new in bzr 0.8. |
19 | - """ |
20 | - |
21 | - def _branch_class(self): |
22 | - return BzrBranch5 |
23 | - |
24 | - @classmethod |
25 | - def get_format_string(cls): |
26 | - """See BranchFormat.get_format_string().""" |
27 | - return "Bazaar-NG branch format 5\n" |
28 | - |
29 | - def get_format_description(self): |
30 | - """See BranchFormat.get_format_description().""" |
31 | - return "Branch format 5" |
32 | - |
33 | - def initialize(self, a_bzrdir, name=None, repository=None, |
34 | - append_revisions_only=None): |
35 | - """Create a branch of this format in a_bzrdir.""" |
36 | - if append_revisions_only: |
37 | - raise errors.UpgradeRequired(a_bzrdir.user_url) |
38 | - utf8_files = [('revision-history', ''), |
39 | - ('branch-name', ''), |
40 | - ] |
41 | - return self._initialize_helper(a_bzrdir, utf8_files, name, repository) |
42 | - |
43 | - def supports_tags(self): |
44 | - return False |
45 | - |
46 | - |
47 | class BzrBranchFormat6(BranchFormatMetadir): |
48 | """Branch format with last-revision and tags. |
49 | |
50 | @@ -2332,11 +2293,11 @@ |
51 | |
52 | # formats which have no format string are not discoverable |
53 | # and not independently creatable, so are not registered. |
54 | -__format5 = BzrBranchFormat5() |
55 | __format6 = BzrBranchFormat6() |
56 | __format7 = BzrBranchFormat7() |
57 | __format8 = BzrBranchFormat8() |
58 | -format_registry.register(__format5) |
59 | +format_registry.register_lazy( |
60 | + "Bazaar-NG branch format 5\n", "bzrlib.branchfmt.fullhistory", "BzrBranchFormat5") |
61 | format_registry.register(BranchReferenceFormat()) |
62 | format_registry.register(__format6) |
63 | format_registry.register(__format7) |
64 | @@ -2662,106 +2623,6 @@ |
65 | self.control_transport.put_bytes('format', self._format.as_string()) |
66 | |
67 | |
68 | -class FullHistoryBzrBranch(BzrBranch): |
69 | - """Bzr branch which contains the full revision history.""" |
70 | - |
71 | - @needs_write_lock |
72 | - def set_last_revision_info(self, revno, revision_id): |
73 | - if not revision_id or not isinstance(revision_id, basestring): |
74 | - raise errors.InvalidRevisionId(revision_id=revision_id, branch=self) |
75 | - revision_id = _mod_revision.ensure_null(revision_id) |
76 | - # this old format stores the full history, but this api doesn't |
77 | - # provide it, so we must generate, and might as well check it's |
78 | - # correct |
79 | - history = self._lefthand_history(revision_id) |
80 | - if len(history) != revno: |
81 | - raise AssertionError('%d != %d' % (len(history), revno)) |
82 | - self._set_revision_history(history) |
83 | - |
84 | - def _read_last_revision_info(self): |
85 | - rh = self._revision_history() |
86 | - revno = len(rh) |
87 | - if revno: |
88 | - return (revno, rh[-1]) |
89 | - else: |
90 | - return (0, _mod_revision.NULL_REVISION) |
91 | - |
92 | - def _set_revision_history(self, rev_history): |
93 | - if 'evil' in debug.debug_flags: |
94 | - mutter_callsite(3, "set_revision_history scales with history.") |
95 | - check_not_reserved_id = _mod_revision.check_not_reserved_id |
96 | - for rev_id in rev_history: |
97 | - check_not_reserved_id(rev_id) |
98 | - if Branch.hooks['post_change_branch_tip']: |
99 | - # Don't calculate the last_revision_info() if there are no hooks |
100 | - # that will use it. |
101 | - old_revno, old_revid = self.last_revision_info() |
102 | - if len(rev_history) == 0: |
103 | - revid = _mod_revision.NULL_REVISION |
104 | - else: |
105 | - revid = rev_history[-1] |
106 | - self._run_pre_change_branch_tip_hooks(len(rev_history), revid) |
107 | - self._write_revision_history(rev_history) |
108 | - self._clear_cached_state() |
109 | - self._cache_revision_history(rev_history) |
110 | - if Branch.hooks['post_change_branch_tip']: |
111 | - self._run_post_change_branch_tip_hooks(old_revno, old_revid) |
112 | - |
113 | - def _write_revision_history(self, history): |
114 | - """Factored out of set_revision_history. |
115 | - |
116 | - This performs the actual writing to disk. |
117 | - It is intended to be called by set_revision_history.""" |
118 | - self._transport.put_bytes( |
119 | - 'revision-history', '\n'.join(history), |
120 | - mode=self.bzrdir._get_file_mode()) |
121 | - |
122 | - def _gen_revision_history(self): |
123 | - history = self._transport.get_bytes('revision-history').split('\n') |
124 | - if history[-1:] == ['']: |
125 | - # There shouldn't be a trailing newline, but just in case. |
126 | - history.pop() |
127 | - return history |
128 | - |
129 | - def _synchronize_history(self, destination, revision_id): |
130 | - if not isinstance(destination, FullHistoryBzrBranch): |
131 | - super(BzrBranch, self)._synchronize_history( |
132 | - destination, revision_id) |
133 | - return |
134 | - if revision_id == _mod_revision.NULL_REVISION: |
135 | - new_history = [] |
136 | - else: |
137 | - new_history = self._revision_history() |
138 | - if revision_id is not None and new_history != []: |
139 | - try: |
140 | - new_history = new_history[:new_history.index(revision_id) + 1] |
141 | - except ValueError: |
142 | - rev = self.repository.get_revision(revision_id) |
143 | - new_history = rev.get_history(self.repository)[1:] |
144 | - destination._set_revision_history(new_history) |
145 | - |
146 | - @needs_write_lock |
147 | - def generate_revision_history(self, revision_id, last_rev=None, |
148 | - other_branch=None): |
149 | - """Create a new revision history that will finish with revision_id. |
150 | - |
151 | - :param revision_id: the new tip to use. |
152 | - :param last_rev: The previous last_revision. If not None, then this |
153 | - must be a ancestory of revision_id, or DivergedBranches is raised. |
154 | - :param other_branch: The other branch that DivergedBranches should |
155 | - raise with respect to. |
156 | - """ |
157 | - self._set_revision_history(self._lefthand_history(revision_id, |
158 | - last_rev, other_branch)) |
159 | - |
160 | - |
161 | -class BzrBranch5(FullHistoryBzrBranch): |
162 | - """A format 5 branch. This supports new features over plain branches. |
163 | - |
164 | - It has support for a master_branch which is the data for bound branches. |
165 | - """ |
166 | - |
167 | - |
168 | class BzrBranch8(BzrBranch): |
169 | """A branch that stores tree-reference locations.""" |
170 | |
171 | |
172 | === added directory 'bzrlib/branchfmt' |
173 | === added file 'bzrlib/branchfmt/__init__.py' |
174 | --- bzrlib/branchfmt/__init__.py 1970-01-01 00:00:00 +0000 |
175 | +++ bzrlib/branchfmt/__init__.py 2012-07-06 17:08:19 +0000 |
176 | @@ -0,0 +1,25 @@ |
177 | +# Copyright (C) 2012 Canonical Ltd |
178 | +# |
179 | +# This program is free software; you can redistribute it and/or modify |
180 | +# it under the terms of the GNU General Public License as published by |
181 | +# the Free Software Foundation; either version 2 of the License, or |
182 | +# (at your option) any later version. |
183 | +# |
184 | +# This program is distributed in the hope that it will be useful, |
185 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
186 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
187 | +# GNU General Public License for more details. |
188 | +# |
189 | +# You should have received a copy of the GNU General Public License |
190 | +# along with this program; if not, write to the Free Software |
191 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
192 | + |
193 | +"""Branch formats. |
194 | + |
195 | +This package contains various branch format implementations. Ideally |
196 | +all specific format implementations will be moved out of bzrlib.branch |
197 | +into this package. |
198 | +""" |
199 | + |
200 | +from __future__ import absolute_import |
201 | + |
202 | |
203 | === added file 'bzrlib/branchfmt/fullhistory.py' |
204 | --- bzrlib/branchfmt/fullhistory.py 1970-01-01 00:00:00 +0000 |
205 | +++ bzrlib/branchfmt/fullhistory.py 2012-07-06 17:08:19 +0000 |
206 | @@ -0,0 +1,178 @@ |
207 | +# Copyright (C) 2006-2012 Canonical Ltd |
208 | +# |
209 | +# This program is free software; you can redistribute it and/or modify |
210 | +# it under the terms of the GNU General Public License as published by |
211 | +# the Free Software Foundation; either version 2 of the License, or |
212 | +# (at your option) any later version. |
213 | +# |
214 | +# This program is distributed in the hope that it will be useful, |
215 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
216 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
217 | +# GNU General Public License for more details. |
218 | +# |
219 | +# You should have received a copy of the GNU General Public License |
220 | +# along with this program; if not, write to the Free Software |
221 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
222 | + |
223 | +"""Full history branch formats.""" |
224 | + |
225 | +from __future__ import absolute_import |
226 | + |
227 | +from bzrlib import ( |
228 | + debug, |
229 | + errors, |
230 | + revision as _mod_revision, |
231 | + ) |
232 | + |
233 | +from bzrlib.branch import ( |
234 | + Branch, |
235 | + BranchFormatMetadir, |
236 | + BzrBranch, |
237 | + ) |
238 | + |
239 | +from bzrlib.decorators import ( |
240 | + needs_write_lock, |
241 | + ) |
242 | +from bzrlib.trace import mutter_callsite |
243 | + |
244 | + |
245 | +class FullHistoryBzrBranch(BzrBranch): |
246 | + """Bzr branch which contains the full revision history.""" |
247 | + |
248 | + @needs_write_lock |
249 | + def set_last_revision_info(self, revno, revision_id): |
250 | + if not revision_id or not isinstance(revision_id, basestring): |
251 | + raise errors.InvalidRevisionId(revision_id=revision_id, branch=self) |
252 | + revision_id = _mod_revision.ensure_null(revision_id) |
253 | + # this old format stores the full history, but this api doesn't |
254 | + # provide it, so we must generate, and might as well check it's |
255 | + # correct |
256 | + history = self._lefthand_history(revision_id) |
257 | + if len(history) != revno: |
258 | + raise AssertionError('%d != %d' % (len(history), revno)) |
259 | + self._set_revision_history(history) |
260 | + |
261 | + def _read_last_revision_info(self): |
262 | + rh = self._revision_history() |
263 | + revno = len(rh) |
264 | + if revno: |
265 | + return (revno, rh[-1]) |
266 | + else: |
267 | + return (0, _mod_revision.NULL_REVISION) |
268 | + |
269 | + def _set_revision_history(self, rev_history): |
270 | + if 'evil' in debug.debug_flags: |
271 | + mutter_callsite(3, "set_revision_history scales with history.") |
272 | + check_not_reserved_id = _mod_revision.check_not_reserved_id |
273 | + for rev_id in rev_history: |
274 | + check_not_reserved_id(rev_id) |
275 | + if Branch.hooks['post_change_branch_tip']: |
276 | + # Don't calculate the last_revision_info() if there are no hooks |
277 | + # that will use it. |
278 | + old_revno, old_revid = self.last_revision_info() |
279 | + if len(rev_history) == 0: |
280 | + revid = _mod_revision.NULL_REVISION |
281 | + else: |
282 | + revid = rev_history[-1] |
283 | + self._run_pre_change_branch_tip_hooks(len(rev_history), revid) |
284 | + self._write_revision_history(rev_history) |
285 | + self._clear_cached_state() |
286 | + self._cache_revision_history(rev_history) |
287 | + if Branch.hooks['post_change_branch_tip']: |
288 | + self._run_post_change_branch_tip_hooks(old_revno, old_revid) |
289 | + |
290 | + def _write_revision_history(self, history): |
291 | + """Factored out of set_revision_history. |
292 | + |
293 | + This performs the actual writing to disk. |
294 | + It is intended to be called by set_revision_history.""" |
295 | + self._transport.put_bytes( |
296 | + 'revision-history', '\n'.join(history), |
297 | + mode=self.bzrdir._get_file_mode()) |
298 | + |
299 | + def _gen_revision_history(self): |
300 | + history = self._transport.get_bytes('revision-history').split('\n') |
301 | + if history[-1:] == ['']: |
302 | + # There shouldn't be a trailing newline, but just in case. |
303 | + history.pop() |
304 | + return history |
305 | + |
306 | + def _synchronize_history(self, destination, revision_id): |
307 | + if not isinstance(destination, FullHistoryBzrBranch): |
308 | + super(BzrBranch, self)._synchronize_history( |
309 | + destination, revision_id) |
310 | + return |
311 | + if revision_id == _mod_revision.NULL_REVISION: |
312 | + new_history = [] |
313 | + else: |
314 | + new_history = self._revision_history() |
315 | + if revision_id is not None and new_history != []: |
316 | + try: |
317 | + new_history = new_history[:new_history.index(revision_id) + 1] |
318 | + except ValueError: |
319 | + rev = self.repository.get_revision(revision_id) |
320 | + new_history = rev.get_history(self.repository)[1:] |
321 | + destination._set_revision_history(new_history) |
322 | + |
323 | + @needs_write_lock |
324 | + def generate_revision_history(self, revision_id, last_rev=None, |
325 | + other_branch=None): |
326 | + """Create a new revision history that will finish with revision_id. |
327 | + |
328 | + :param revision_id: the new tip to use. |
329 | + :param last_rev: The previous last_revision. If not None, then this |
330 | + must be a ancestory of revision_id, or DivergedBranches is raised. |
331 | + :param other_branch: The other branch that DivergedBranches should |
332 | + raise with respect to. |
333 | + """ |
334 | + self._set_revision_history(self._lefthand_history(revision_id, |
335 | + last_rev, other_branch)) |
336 | + |
337 | + |
338 | +class BzrBranch5(FullHistoryBzrBranch): |
339 | + """A format 5 branch. This supports new features over plain branches. |
340 | + |
341 | + It has support for a master_branch which is the data for bound branches. |
342 | + """ |
343 | + |
344 | + |
345 | +class BzrBranchFormat5(BranchFormatMetadir): |
346 | + """Bzr branch format 5. |
347 | + |
348 | + This format has: |
349 | + - a revision-history file. |
350 | + - a format string |
351 | + - a lock dir guarding the branch itself |
352 | + - all of this stored in a branch/ subdirectory |
353 | + - works with shared repositories. |
354 | + |
355 | + This format is new in bzr 0.8. |
356 | + """ |
357 | + |
358 | + def _branch_class(self): |
359 | + return BzrBranch5 |
360 | + |
361 | + @classmethod |
362 | + def get_format_string(cls): |
363 | + """See BranchFormat.get_format_string().""" |
364 | + return "Bazaar-NG branch format 5\n" |
365 | + |
366 | + def get_format_description(self): |
367 | + """See BranchFormat.get_format_description().""" |
368 | + return "Branch format 5" |
369 | + |
370 | + def initialize(self, a_bzrdir, name=None, repository=None, |
371 | + append_revisions_only=None): |
372 | + """Create a branch of this format in a_bzrdir.""" |
373 | + if append_revisions_only: |
374 | + raise errors.UpgradeRequired(a_bzrdir.user_url) |
375 | + utf8_files = [('revision-history', ''), |
376 | + ('branch-name', ''), |
377 | + ] |
378 | + return self._initialize_helper(a_bzrdir, utf8_files, name, repository) |
379 | + |
380 | + def supports_tags(self): |
381 | + return False |
382 | + |
383 | + |
384 | + |
385 | |
386 | === modified file 'bzrlib/bzrdir.py' |
387 | --- bzrlib/bzrdir.py 2012-06-18 11:43:07 +0000 |
388 | +++ bzrlib/bzrdir.py 2012-07-06 17:08:19 +0000 |
389 | @@ -53,6 +53,7 @@ |
390 | workingtree_3, |
391 | workingtree_4, |
392 | ) |
393 | +from bzrlib.branchfmt import fullhistory as fullhistorybranch |
394 | from bzrlib.repofmt import knitpack_repo |
395 | from bzrlib.transport import ( |
396 | do_catching_redirections, |
397 | @@ -1811,7 +1812,7 @@ |
398 | old = branch._format.__class__ |
399 | new = self.target_format.get_branch_format().__class__ |
400 | while old != new: |
401 | - if (old == _mod_branch.BzrBranchFormat5 and |
402 | + if (old == fullhistorybranch.BzrBranchFormat5 and |
403 | new in (_mod_branch.BzrBranchFormat6, |
404 | _mod_branch.BzrBranchFormat7, |
405 | _mod_branch.BzrBranchFormat8)): |
406 | @@ -2113,7 +2114,7 @@ |
407 | register_metadir(controldir.format_registry, 'knit', |
408 | 'bzrlib.repofmt.knitrepo.RepositoryFormatKnit1', |
409 | 'Format using knits. Recommended for interoperation with bzr <= 0.14.', |
410 | - branch_format='bzrlib.branch.BzrBranchFormat5', |
411 | + branch_format='bzrlib.branchfmt.fullhistory.BzrBranchFormat5', |
412 | tree_format='bzrlib.workingtree_3.WorkingTreeFormat3', |
413 | hidden=True, |
414 | deprecated=True) |
415 | @@ -2122,7 +2123,7 @@ |
416 | help='Format using dirstate for working trees. ' |
417 | 'Compatible with bzr 0.8 and ' |
418 | 'above when accessed over the network. Introduced in bzr 0.15.', |
419 | - branch_format='bzrlib.branch.BzrBranchFormat5', |
420 | + branch_format='bzrlib.branchfmt.fullhistory.BzrBranchFormat5', |
421 | tree_format='bzrlib.workingtree_4.WorkingTreeFormat4', |
422 | hidden=True, |
423 | deprecated=True) |
424 | |
425 | === modified file 'bzrlib/plugins/weave_fmt/__init__.py' |
426 | --- bzrlib/plugins/weave_fmt/__init__.py 2011-12-18 12:46:49 +0000 |
427 | +++ bzrlib/plugins/weave_fmt/__init__.py 2012-07-06 17:08:19 +0000 |
428 | @@ -86,7 +86,7 @@ |
429 | register_metadir(controldir.format_registry, 'metaweave', |
430 | 'bzrlib.plugins.weave_fmt.repository.RepositoryFormat7', |
431 | 'Transitional format in 0.8. Slower than knit.', |
432 | - branch_format='bzrlib.branch.BzrBranchFormat5', |
433 | + branch_format='bzrlib.branchfmt.fullhistory.BzrBranchFormat5', |
434 | tree_format='bzrlib.workingtree_3.WorkingTreeFormat3', |
435 | hidden=True, |
436 | deprecated=True) |
437 | |
438 | === modified file 'bzrlib/plugins/weave_fmt/branch.py' |
439 | --- bzrlib/plugins/weave_fmt/branch.py 2012-07-02 10:42:23 +0000 |
440 | +++ bzrlib/plugins/weave_fmt/branch.py 2012-07-06 17:08:19 +0000 |
441 | @@ -34,6 +34,8 @@ |
442 | from bzrlib.branch import ( |
443 | BranchFormat, |
444 | BranchWriteLockResult, |
445 | + ) |
446 | +from bzrlib.branchfmt.fullhistory import ( |
447 | FullHistoryBzrBranch, |
448 | ) |
449 | |
450 | |
451 | === modified file 'bzrlib/plugins/weave_fmt/bzrdir.py' |
452 | --- bzrlib/plugins/weave_fmt/bzrdir.py 2012-02-23 23:26:35 +0000 |
453 | +++ bzrlib/plugins/weave_fmt/bzrdir.py 2012-07-06 17:08:19 +0000 |
454 | @@ -545,7 +545,7 @@ |
455 | def convert(self, to_convert, pb): |
456 | """See Converter.convert().""" |
457 | from bzrlib.plugins.weave_fmt.repository import RepositoryFormat7 |
458 | - from bzrlib.branch import BzrBranchFormat5 |
459 | + from bzrlib.branchfmt.fullhistory import BzrBranchFormat5 |
460 | self.bzrdir = to_convert |
461 | self.pb = ui.ui_factory.nested_progress_bar() |
462 | self.count = 0 |
463 | |
464 | === modified file 'bzrlib/tests/per_repository/test_repository.py' |
465 | --- bzrlib/tests/per_repository/test_repository.py 2012-01-27 16:27:26 +0000 |
466 | +++ bzrlib/tests/per_repository/test_repository.py 2012-07-06 17:08:19 +0000 |
467 | @@ -628,7 +628,7 @@ |
468 | self.get_vfs_only_url('remote')).open_repository() |
469 | # Make a branch in that repo in an old format that isn't the default |
470 | # branch format for the repo. |
471 | - from bzrlib.branch import BzrBranchFormat5 |
472 | + from bzrlib.branchfmt.fullhistory import BzrBranchFormat5 |
473 | format = remote_backing_repo.bzrdir.cloning_metadir() |
474 | format._branch_format = BzrBranchFormat5() |
475 | remote_transport = remote_repo.bzrdir.root_transport.clone('branch') |
476 | |
477 | === modified file 'bzrlib/tests/test_branch.py' |
478 | --- bzrlib/tests/test_branch.py 2012-03-28 16:13:49 +0000 |
479 | +++ bzrlib/tests/test_branch.py 2012-07-06 17:08:19 +0000 |
480 | @@ -30,11 +30,14 @@ |
481 | config, |
482 | controldir, |
483 | errors, |
484 | - symbol_versioning, |
485 | tests, |
486 | trace, |
487 | urlutils, |
488 | ) |
489 | +from bzrlib.branchfmt.fullhistory import ( |
490 | + BzrBranch5, |
491 | + BzrBranchFormat5, |
492 | + ) |
493 | |
494 | |
495 | class TestDefaultFormat(tests.TestCase): |
496 | @@ -75,10 +78,10 @@ |
497 | url = self.get_url() |
498 | bdir = bzrdir.BzrDirMetaFormat1().initialize(url) |
499 | bdir.create_repository() |
500 | - branch = _mod_branch.BzrBranchFormat5().initialize(bdir) |
501 | + branch = BzrBranchFormat5().initialize(bdir) |
502 | t = self.get_transport() |
503 | self.log("branch instance is %r" % branch) |
504 | - self.assert_(isinstance(branch, _mod_branch.BzrBranch5)) |
505 | + self.assert_(isinstance(branch, BzrBranch5)) |
506 | self.assertIsDirectory('.', t) |
507 | self.assertIsDirectory('.bzr/branch', t) |
508 | self.assertIsDirectory('.bzr/branch/lock', t) |
509 | @@ -185,7 +188,7 @@ |
510 | format.initialize(dir) |
511 | found_format = _mod_branch.BranchFormatMetadir.find_format(dir) |
512 | self.assertIsInstance(found_format, format.__class__) |
513 | - check_format(_mod_branch.BzrBranchFormat5(), "bar") |
514 | + check_format(BzrBranchFormat5(), "bar") |
515 | |
516 | def test_find_format_factory(self): |
517 | dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url()) |
518 | |
519 | === modified file 'bzrlib/tests/test_bzrdir.py' |
520 | --- bzrlib/tests/test_bzrdir.py 2012-06-18 11:43:07 +0000 |
521 | +++ bzrlib/tests/test_bzrdir.py 2012-07-06 17:08:19 +0000 |
522 | @@ -35,7 +35,6 @@ |
523 | revision as _mod_revision, |
524 | osutils, |
525 | remote, |
526 | - symbol_versioning, |
527 | transport as _mod_transport, |
528 | urlutils, |
529 | win32utils, |
530 | @@ -43,6 +42,7 @@ |
531 | workingtree_4, |
532 | ) |
533 | import bzrlib.branch |
534 | +from bzrlib.branchfmt.fullhistory import BzrBranchFormat5 |
535 | from bzrlib.errors import ( |
536 | NotBranchError, |
537 | NoColocatedBranchSupport, |
538 | @@ -992,7 +992,7 @@ |
539 | branch_base = t.clone('branch').base |
540 | self.assertEqual(branch_base, dir.get_branch_transport(None).base) |
541 | self.assertEqual(branch_base, |
542 | - dir.get_branch_transport(bzrlib.branch.BzrBranchFormat5()).base) |
543 | + dir.get_branch_transport(BzrBranchFormat5()).base) |
544 | repository_base = t.clone('repository').base |
545 | self.assertEqual(repository_base, dir.get_repository_transport(None).base) |
546 | repository_format = repository.format_registry.get_default() |
I'm not sure I understand the purpose of the proposal here, it seems like a step towards... something I can't put my finger on ;)
Should branchfmt be named branch_ old_formats_ you_should_ not_use_ anymore ?
If not, what kind of modules will be added there ? When ?
No objection per se but I've got the feeling we don't use the right names here nor put this code in the right place.
I think I would feel more comfortable if this code could be handled in the same way the weave code was but if it's too early for that may be we should just wait.
Can you clarify ?