Merge lp:~lifeless/bzr/bug-398668 into lp:~bzr/bzr/trunk-old
- bug-398668
- Merge into trunk-old
Proposed by
Robert Collins
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~lifeless/bzr/bug-398668 | ||||
Merge into: | lp:~bzr/bzr/trunk-old | ||||
Diff against target: | 883 lines | ||||
To merge this branch: | bzr merge lp:~lifeless/bzr/bug-398668 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
bzr-core | Pending | ||
Review via email: mp+10283@code.launchpad.net |
This proposal has been superseded by a proposal from 2009-08-17.
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'NEWS' |
2 | --- NEWS 2009-08-15 09:15:03 +0000 |
3 | +++ NEWS 2009-08-17 22:35:23 +0000 |
4 | @@ -58,6 +58,11 @@ |
5 | * StreamSource generates rich roots from non-rich root sources correctly |
6 | now. (Andrew Bennetts, #368921) |
7 | |
8 | +* When deciding whether a repository was compatible for upgrading or |
9 | + fetching, we previously incorrectly checked the default repository |
10 | + format for the bzrdir format, rather than the format that was actually |
11 | + present on disk. (Martin Pool, #408824) |
12 | + |
13 | Improvements |
14 | ************ |
15 | |
16 | |
17 | === modified file 'bzrlib/branch.py' |
18 | --- bzrlib/branch.py 2009-08-13 20:10:26 +0000 |
19 | +++ bzrlib/branch.py 2009-08-17 22:35:23 +0000 |
20 | @@ -1147,6 +1147,9 @@ |
21 | revision_id: if not None, the revision history in the new branch will |
22 | be truncated to end with revision_id. |
23 | """ |
24 | + if (repository_policy is not None and |
25 | + repository_policy.requires_stacking()): |
26 | + to_bzrdir._format.require_stacking(_skip_repo=True) |
27 | result = to_bzrdir.create_branch() |
28 | result.lock_write() |
29 | try: |
30 | @@ -2064,7 +2067,7 @@ |
31 | BranchFormat.register_format(__format6) |
32 | BranchFormat.register_format(__format7) |
33 | BranchFormat.register_format(__format8) |
34 | -BranchFormat.set_default_format(__format6) |
35 | +BranchFormat.set_default_format(__format7) |
36 | _legacy_formats = [BzrBranchFormat4(), |
37 | ] |
38 | network_format_registry.register( |
39 | |
40 | === modified file 'bzrlib/bzrdir.py' |
41 | --- bzrlib/bzrdir.py 2009-08-14 09:31:37 +0000 |
42 | +++ bzrlib/bzrdir.py 2009-08-17 22:35:23 +0000 |
43 | @@ -130,8 +130,7 @@ |
44 | |
45 | def check_conversion_target(self, target_format): |
46 | target_repo_format = target_format.repository_format |
47 | - source_repo_format = self._format.repository_format |
48 | - source_repo_format.check_conversion_target(target_repo_format) |
49 | + self.open_repository()._format.check_conversion_target(target_repo_format) |
50 | |
51 | @staticmethod |
52 | def _check_supported(format, allow_unsupported, |
53 | @@ -3549,6 +3548,10 @@ |
54 | if self._require_stacking: |
55 | raise |
56 | |
57 | + def requires_stacking(self): |
58 | + """Return True if this policy requires stacking.""" |
59 | + return self._stack_on is not None and self._require_stacking |
60 | + |
61 | def _get_full_stack_on(self): |
62 | """Get a fully-qualified URL for the stack_on location.""" |
63 | if self._stack_on is None: |
64 | @@ -3861,11 +3864,11 @@ |
65 | # The following format should be an alias for the rich root equivalent |
66 | # of the default format |
67 | format_registry.register_metadir('default-rich-root', |
68 | - 'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack4', |
69 | - help='Default format, rich root variant. (needed for bzr-svn and bzr-git).', |
70 | - branch_format='bzrlib.branch.BzrBranchFormat6', |
71 | - tree_format='bzrlib.workingtree.WorkingTreeFormat4', |
72 | + 'bzrlib.repofmt.groupcompress_repo.RepositoryFormat2a', |
73 | + branch_format='bzrlib.branch.BzrBranchFormat7', |
74 | + tree_format='bzrlib.workingtree.WorkingTreeFormat6', |
75 | alias=True, |
76 | - ) |
77 | + help='Same as 2a.') |
78 | + |
79 | # The current format that is made on 'bzr init'. |
80 | -format_registry.set_default('pack-0.92') |
81 | +format_registry.set_default('2a') |
82 | |
83 | === modified file 'bzrlib/remote.py' |
84 | --- bzrlib/remote.py 2009-08-14 09:31:37 +0000 |
85 | +++ bzrlib/remote.py 2009-08-17 22:35:23 +0000 |
86 | @@ -566,17 +566,6 @@ |
87 | def __eq__(self, other): |
88 | return self.__class__ is other.__class__ |
89 | |
90 | - def check_conversion_target(self, target_format): |
91 | - if self.rich_root_data and not target_format.rich_root_data: |
92 | - raise errors.BadConversionTarget( |
93 | - 'Does not support rich root data.', target_format, |
94 | - from_format=self) |
95 | - if (self.supports_tree_reference and |
96 | - not getattr(target_format, 'supports_tree_reference', False)): |
97 | - raise errors.BadConversionTarget( |
98 | - 'Does not support nested trees', target_format, |
99 | - from_format=self) |
100 | - |
101 | def network_name(self): |
102 | if self._network_name: |
103 | return self._network_name |
104 | |
105 | === modified file 'bzrlib/repofmt/groupcompress_repo.py' |
106 | --- bzrlib/repofmt/groupcompress_repo.py 2009-08-14 09:37:57 +0000 |
107 | +++ bzrlib/repofmt/groupcompress_repo.py 2009-08-17 22:35:23 +0000 |
108 | @@ -810,9 +810,15 @@ |
109 | yield inventory.CHKInventory.deserialise(self.chk_bytes, texts[key], key) |
110 | |
111 | def _iter_inventory_xmls(self, revision_ids, ordering): |
112 | - # Without a native 'xml' inventory, this method doesn't make sense, so |
113 | - # make it raise to trap naughty direct users. |
114 | - raise NotImplementedError(self._iter_inventory_xmls) |
115 | + # Without a native 'xml' inventory, this method doesn't make sense. |
116 | + # However older working trees, and older bundles want it - so we supply |
117 | + # it allowing get_inventory_xml to work. Bundles currently use the |
118 | + # serializer directly; this also isn't ideal, but there isn't an xml |
119 | + # iteration interface offered at all for repositories. We could make |
120 | + # _iter_inventory_xmls be part of the contract, even if kept private. |
121 | + inv_to_str = self._serializer.write_inventory_to_string |
122 | + for inv in self.iter_inventories(revision_ids, ordering): |
123 | + yield inv_to_str(inv), inv.revision_id |
124 | |
125 | def _find_present_inventory_keys(self, revision_keys): |
126 | parent_map = self.inventories.get_parent_map(revision_keys) |
127 | |
128 | === modified file 'bzrlib/repofmt/knitrepo.py' |
129 | --- bzrlib/repofmt/knitrepo.py 2009-08-14 09:37:57 +0000 |
130 | +++ bzrlib/repofmt/knitrepo.py 2009-08-17 22:35:23 +0000 |
131 | @@ -424,9 +424,6 @@ |
132 | """See RepositoryFormat.get_format_description().""" |
133 | return "Knit repository format 1" |
134 | |
135 | - def check_conversion_target(self, target_format): |
136 | - pass |
137 | - |
138 | |
139 | class RepositoryFormatKnit3(RepositoryFormatKnit): |
140 | """Bzr repository knit format 3. |
141 | |
142 | === modified file 'bzrlib/repofmt/pack_repo.py' |
143 | --- bzrlib/repofmt/pack_repo.py 2009-08-14 09:37:57 +0000 |
144 | +++ bzrlib/repofmt/pack_repo.py 2009-08-17 22:35:23 +0000 |
145 | @@ -2529,9 +2529,6 @@ |
146 | """See RepositoryFormat.get_format_description().""" |
147 | return "Packs containing knits without subtree support" |
148 | |
149 | - def check_conversion_target(self, target_format): |
150 | - pass |
151 | - |
152 | |
153 | class RepositoryFormatKnitPack3(RepositoryFormatPack): |
154 | """A subtrees parameterized Pack repository. |
155 | @@ -2647,9 +2644,6 @@ |
156 | """See RepositoryFormat.get_format_description().""" |
157 | return "Packs 5 (adds stacking support, requires bzr 1.6)" |
158 | |
159 | - def check_conversion_target(self, target_format): |
160 | - pass |
161 | - |
162 | |
163 | class RepositoryFormatKnitPack5RichRoot(RepositoryFormatPack): |
164 | """A repository with rich roots and stacking. |
165 | @@ -2771,9 +2765,6 @@ |
166 | """See RepositoryFormat.get_format_description().""" |
167 | return "Packs 6 (uses btree indexes, requires bzr 1.9)" |
168 | |
169 | - def check_conversion_target(self, target_format): |
170 | - pass |
171 | - |
172 | |
173 | class RepositoryFormatKnitPack6RichRoot(RepositoryFormatPack): |
174 | """A repository with rich roots, no subtrees, stacking and btree indexes. |
175 | |
176 | === modified file 'bzrlib/repofmt/weaverepo.py' |
177 | --- bzrlib/repofmt/weaverepo.py 2009-04-09 20:23:07 +0000 |
178 | +++ bzrlib/repofmt/weaverepo.py 2009-08-17 22:35:23 +0000 |
179 | @@ -319,9 +319,6 @@ |
180 | result.chk_bytes = None |
181 | return result |
182 | |
183 | - def check_conversion_target(self, target_format): |
184 | - pass |
185 | - |
186 | |
187 | class RepositoryFormat4(PreSplitOutRepositoryFormat): |
188 | """Bzr repository format 4. |
189 | @@ -494,9 +491,6 @@ |
190 | """See RepositoryFormat.get_format_description().""" |
191 | return "Weave repository format 7" |
192 | |
193 | - def check_conversion_target(self, target_format): |
194 | - pass |
195 | - |
196 | def _get_inventories(self, repo_transport, repo, name='inventory'): |
197 | mapper = versionedfile.ConstantMapper(name) |
198 | return versionedfile.ThunkedVersionedFiles(repo_transport, |
199 | |
200 | === modified file 'bzrlib/repository.py' |
201 | --- bzrlib/repository.py 2009-08-14 09:37:57 +0000 |
202 | +++ bzrlib/repository.py 2009-08-17 22:35:23 +0000 |
203 | @@ -3057,6 +3057,8 @@ |
204 | # help), and for fetching when data won't have come from the same |
205 | # compressor. |
206 | pack_compresses = False |
207 | + # Does the repository inventory storage understand references to trees? |
208 | + supports_tree_reference = None |
209 | |
210 | def __str__(self): |
211 | return "<%s>" % self.__class__.__name__ |
212 | |
213 | === modified file 'bzrlib/tests/blackbox/test_info.py' |
214 | --- bzrlib/tests/blackbox/test_info.py 2009-08-14 13:55:30 +0000 |
215 | +++ bzrlib/tests/blackbox/test_info.py 2009-08-17 22:35:23 +0000 |
216 | @@ -37,11 +37,7 @@ |
217 | |
218 | def setUp(self): |
219 | ExternalBase.setUp(self) |
220 | - self._repo_strings = ( |
221 | - "1.6 or 1.6.1-rich-root " |
222 | - "or 1.9 or 1.9-rich-root " |
223 | - "or dirstate or dirstate-tags or " |
224 | - "pack-0.92 or rich-root or rich-root-pack") |
225 | + self._repo_strings = "2a or development-subtree" |
226 | |
227 | def test_info_non_existing(self): |
228 | if sys.platform == "win32": |
229 | @@ -291,7 +287,7 @@ |
230 | |
231 | Format: |
232 | control: Meta directory format 1 |
233 | - working tree: Working tree format 4 |
234 | + working tree: Working tree format 6 |
235 | branch: Branch format 4 |
236 | repository: Weave repository format 6 |
237 | |
238 | @@ -453,7 +449,7 @@ |
239 | |
240 | Format: |
241 | control: Meta directory format 1 |
242 | - working tree: Working tree format 4 |
243 | + working tree: Working tree format 6 |
244 | branch: Branch format 4 |
245 | repository: Weave repository format 6 |
246 | |
247 | @@ -586,7 +582,7 @@ |
248 | |
249 | Format: |
250 | control: Meta directory format 1 |
251 | - working tree: Working tree format 4 |
252 | + working tree: Working tree format 6 |
253 | branch: %s |
254 | repository: %s |
255 | |
256 | @@ -617,14 +613,14 @@ |
257 | # Out of date checkout |
258 | out, err = self.run_bzr('info -v tree/checkout') |
259 | self.assertEqualDiff( |
260 | -"""Checkout (format: dirstate) |
261 | +"""Checkout (format: unnamed) |
262 | Location: |
263 | checkout root: tree/checkout |
264 | checkout of branch: repo/branch |
265 | |
266 | Format: |
267 | control: Meta directory format 1 |
268 | - working tree: Working tree format 4 |
269 | + working tree: Working tree format 6 |
270 | branch: %s |
271 | repository: %s |
272 | |
273 | @@ -656,14 +652,14 @@ |
274 | tree3.add('b') |
275 | out, err = self.run_bzr('info tree/checkout --verbose') |
276 | self.assertEqualDiff( |
277 | -"""Checkout (format: dirstate) |
278 | +"""Checkout (format: unnamed) |
279 | Location: |
280 | checkout root: tree/checkout |
281 | checkout of branch: repo/branch |
282 | |
283 | Format: |
284 | control: Meta directory format 1 |
285 | - working tree: Working tree format 4 |
286 | + working tree: Working tree format 6 |
287 | branch: %s |
288 | repository: %s |
289 | |
290 | @@ -705,7 +701,7 @@ |
291 | |
292 | Format: |
293 | control: Meta directory format 1 |
294 | - working tree: Working tree format 4 |
295 | + working tree: Working tree format 6 |
296 | branch: %s |
297 | repository: %s |
298 | |
299 | @@ -1131,7 +1127,7 @@ |
300 | (False, False): 'Checkout', |
301 | }[(shared_repo is not None, light_checkout)] |
302 | format = {True: self._repo_strings, |
303 | - False: 'dirstate'}[light_checkout] |
304 | + False: 'unnamed'}[light_checkout] |
305 | if repo_locked: |
306 | repo_locked = lco_tree.branch.repository.get_physical_lock_status() |
307 | if repo_locked or branch_locked or tree_locked: |
308 | |
309 | === modified file 'bzrlib/tests/blackbox/test_init.py' |
310 | --- bzrlib/tests/blackbox/test_init.py 2009-08-12 21:58:32 +0000 |
311 | +++ bzrlib/tests/blackbox/test_init.py 2009-08-17 22:35:23 +0000 |
312 | @@ -35,7 +35,7 @@ |
313 | |
314 | def setUp(self): |
315 | ExternalBase.setUp(self) |
316 | - self._default_label = 'pack-0.92' |
317 | + self._default_label = '2a' |
318 | |
319 | def test_init_with_format(self): |
320 | # Verify bzr init --format constructs something plausible |
321 | |
322 | === modified file 'bzrlib/tests/blackbox/test_shared_repository.py' |
323 | --- bzrlib/tests/blackbox/test_shared_repository.py 2009-03-23 14:59:43 +0000 |
324 | +++ bzrlib/tests/blackbox/test_shared_repository.py 2009-08-17 22:35:23 +0000 |
325 | @@ -27,7 +27,7 @@ |
326 | def test_make_repository(self): |
327 | out, err = self.run_bzr("init-repository a") |
328 | self.assertEqual(out, |
329 | -"""Shared repository with trees (format: pack-0.92) |
330 | +"""Shared repository with trees (format: 2a) |
331 | Location: |
332 | shared repository: a |
333 | """) |
334 | |
335 | === modified file 'bzrlib/tests/per_branch/__init__.py' |
336 | --- bzrlib/tests/per_branch/__init__.py 2009-07-10 10:46:00 +0000 |
337 | +++ bzrlib/tests/per_branch/__init__.py 2009-08-17 22:35:23 +0000 |
338 | @@ -78,7 +78,9 @@ |
339 | return self.branch |
340 | |
341 | def make_branch(self, relpath, format=None): |
342 | - repo = self.make_repository(relpath, format=format) |
343 | + if format is not None: |
344 | + return TestCaseWithBzrDir.make_branch(self, relpath, format) |
345 | + repo = self.make_repository(relpath) |
346 | # fixme RBC 20060210 this isnt necessarily a fixable thing, |
347 | # Skipped is the wrong exception to raise. |
348 | try: |
349 | |
350 | === modified file 'bzrlib/tests/per_branch/test_stacking.py' |
351 | --- bzrlib/tests/per_branch/test_stacking.py 2009-08-14 13:55:30 +0000 |
352 | +++ bzrlib/tests/per_branch/test_stacking.py 2009-08-17 22:35:23 +0000 |
353 | @@ -278,14 +278,28 @@ |
354 | self.assertRaises((errors.NotStacked, errors.UnstackableBranchFormat), |
355 | cloned_bzrdir.open_branch().get_stacked_on_url) |
356 | |
357 | + def make_stacked_on_matching(self, source): |
358 | + if source.repository.supports_rich_root(): |
359 | + if source.repository._format.supports_chks: |
360 | + format = "2a" |
361 | + else: |
362 | + format = "1.9-rich-root" |
363 | + else: |
364 | + format = "1.9" |
365 | + return self.make_branch('stack-on', format) |
366 | + |
367 | def test_sprout_stacking_policy_handling(self): |
368 | """Obey policy where possible, ignore otherwise.""" |
369 | - stack_on = self.make_branch('stack-on') |
370 | + if isinstance(self.branch_format, branch.BzrBranchFormat4): |
371 | + raise TestNotApplicable('Branch format 4 does not autoupgrade.') |
372 | + source = self.make_branch('source') |
373 | + stack_on = self.make_stacked_on_matching(source) |
374 | parent_bzrdir = self.make_bzrdir('.', format='default') |
375 | parent_bzrdir.get_config().set_default_stack_on('stack-on') |
376 | - source = self.make_branch('source') |
377 | target = source.bzrdir.sprout('target').open_branch() |
378 | - if self.branch_format.supports_stacking(): |
379 | + # When we sprout we upgrade the branch when there is a default stack_on |
380 | + # set by a config *and* the targeted branch supports stacking. |
381 | + if stack_on._format.supports_stacking(): |
382 | self.assertEqual('../stack-on', target.get_stacked_on_url()) |
383 | else: |
384 | self.assertRaises( |
385 | @@ -293,13 +307,17 @@ |
386 | |
387 | def test_clone_stacking_policy_handling(self): |
388 | """Obey policy where possible, ignore otherwise.""" |
389 | + if isinstance(self.branch_format, branch.BzrBranchFormat4): |
390 | + raise TestNotApplicable('Branch format 4 does not autoupgrade.') |
391 | self.thisFailsStrictLockCheck() |
392 | - stack_on = self.make_branch('stack-on') |
393 | + source = self.make_branch('source') |
394 | + stack_on = self.make_stacked_on_matching(source) |
395 | parent_bzrdir = self.make_bzrdir('.', format='default') |
396 | parent_bzrdir.get_config().set_default_stack_on('stack-on') |
397 | - source = self.make_branch('source') |
398 | target = source.bzrdir.clone('target').open_branch() |
399 | - if self.branch_format.supports_stacking(): |
400 | + # When we clone we upgrade the branch when there is a default stack_on |
401 | + # set by a config *and* the targeted branch supports stacking. |
402 | + if stack_on._format.supports_stacking(): |
403 | self.assertEqual('../stack-on', target.get_stacked_on_url()) |
404 | else: |
405 | self.assertRaises( |
406 | @@ -309,13 +327,15 @@ |
407 | """Obey policy where possible, ignore otherwise.""" |
408 | if isinstance(self.branch_format, branch.BzrBranchFormat4): |
409 | raise TestNotApplicable('Branch format 4 is not usable via HPSS.') |
410 | - stack_on = self.make_branch('stack-on') |
411 | + source = self.make_branch('source') |
412 | + stack_on = self.make_stacked_on_matching(source) |
413 | parent_bzrdir = self.make_bzrdir('.', format='default') |
414 | parent_bzrdir.get_config().set_default_stack_on('stack-on') |
415 | - source = self.make_branch('source') |
416 | url = self.make_smart_server('target').base |
417 | target = source.bzrdir.sprout(url).open_branch() |
418 | - if self.branch_format.supports_stacking(): |
419 | + # When we sprout we upgrade the branch when there is a default stack_on |
420 | + # set by a config *and* the targeted branch supports stacking. |
421 | + if stack_on._format.supports_stacking(): |
422 | self.assertEqual('../stack-on', target.get_stacked_on_url()) |
423 | else: |
424 | self.assertRaises( |
425 | @@ -352,10 +372,10 @@ |
426 | # repository boundaries. however, i didn't actually get this test to |
427 | # fail on that code. -- mbp |
428 | # see https://bugs.launchpad.net/bzr/+bug/252821 |
429 | - if not self.branch_format.supports_stacking(): |
430 | + stack_on = self.make_branch_and_tree('stack-on') |
431 | + if not stack_on.branch._format.supports_stacking(): |
432 | raise TestNotApplicable("%r does not support stacking" |
433 | % self.branch_format) |
434 | - stack_on = self.make_branch_and_tree('stack-on') |
435 | text_lines = ['line %d blah blah blah\n' % i for i in range(20)] |
436 | self.build_tree_contents([('stack-on/a', ''.join(text_lines))]) |
437 | stack_on.add('a') |
438 | |
439 | === modified file 'bzrlib/tests/per_bzrdir/test_bzrdir.py' |
440 | --- bzrlib/tests/per_bzrdir/test_bzrdir.py 2009-08-14 13:55:30 +0000 |
441 | +++ bzrlib/tests/per_bzrdir/test_bzrdir.py 2009-08-17 22:35:23 +0000 |
442 | @@ -1258,7 +1258,7 @@ |
443 | # repository is the same as the external location of the stacked-on |
444 | # branch. |
445 | balloon = self.make_bzrdir('balloon') |
446 | - if isinstance(balloon, bzrdir.BzrDirMetaFormat1): |
447 | + if isinstance(balloon._format, bzrdir.BzrDirMetaFormat1): |
448 | stack_on = self.make_branch('stack-on', format='1.9') |
449 | else: |
450 | stack_on = self.make_branch('stack-on') |
451 | |
452 | === modified file 'bzrlib/tests/per_repository/test_add_fallback_repository.py' |
453 | --- bzrlib/tests/per_repository/test_add_fallback_repository.py 2009-03-23 14:59:43 +0000 |
454 | +++ bzrlib/tests/per_repository/test_add_fallback_repository.py 2009-08-17 22:35:23 +0000 |
455 | @@ -29,14 +29,7 @@ |
456 | class TestAddFallbackRepository(TestCaseWithRepository): |
457 | |
458 | def test_add_fallback_repository(self): |
459 | - if isinstance(self.repository_format, remote.RemoteRepositoryFormat): |
460 | - # RemoteRepository by default builds a default format real |
461 | - # repository, but the default format is unstackble. So explicitly |
462 | - # make a stackable real repository and use that. |
463 | - repo = self.make_repository('repo', format='1.9') |
464 | - repo = bzrdir.BzrDir.open(self.get_url('repo')).open_repository() |
465 | - else: |
466 | - repo = self.make_repository('repo') |
467 | + repo = self.make_repository('repo') |
468 | tree = self.make_branch_and_tree('branch') |
469 | if not repo._format.supports_external_lookups: |
470 | self.assertRaises(errors.UnstackableRepositoryFormat, |
471 | |
472 | === modified file 'bzrlib/tests/per_repository/test_repository.py' |
473 | --- bzrlib/tests/per_repository/test_repository.py 2009-06-26 09:24:34 +0000 |
474 | +++ bzrlib/tests/per_repository/test_repository.py 2009-08-17 22:35:23 +0000 |
475 | @@ -929,8 +929,14 @@ |
476 | transport.mkdir('.') |
477 | target_bzrdir = bzrdir_format.initialize_on_transport(transport) |
478 | branch = BzrBranchFormat6().initialize(target_bzrdir) |
479 | - #branch = self.make_branch('repo/branch', format='pack-0.92') |
480 | - self.make_branch('stack-on-me') |
481 | + if not repo.supports_rich_root(): |
482 | + stack_on_format = "pack-0.92" |
483 | + else: |
484 | + if repo._format.supports_chks: |
485 | + stack_on_format = "2a" |
486 | + else: |
487 | + stack_on_format = "1.9-rich-root" |
488 | + self.make_branch('stack-on-me', format=stack_on_format) |
489 | self.make_bzrdir('.').get_config().set_default_stack_on('stack-on-me') |
490 | target = branch.bzrdir.clone(self.get_url('target')) |
491 | # The target branch supports stacking if the source repository does. |
492 | |
493 | === modified file 'bzrlib/tests/per_workingtree/test_basis_inventory.py' |
494 | --- bzrlib/tests/per_workingtree/test_basis_inventory.py 2009-07-10 07:14:02 +0000 |
495 | +++ bzrlib/tests/per_workingtree/test_basis_inventory.py 2009-08-17 22:35:23 +0000 |
496 | @@ -49,7 +49,7 @@ |
497 | self.assertEquals('r1', basis_inv.revision_id) |
498 | |
499 | store_inv = b.repository.get_inventory('r1') |
500 | - self.assertEquals(store_inv._byid, basis_inv._byid) |
501 | + self.assertEqual([], store_inv._make_delta(basis_inv)) |
502 | |
503 | open('b', 'wb').write('b\n') |
504 | t.add('b') |
505 | @@ -62,7 +62,7 @@ |
506 | self.assertEquals('r2', basis_inv.revision_id) |
507 | store_inv = b.repository.get_inventory('r2') |
508 | |
509 | - self.assertEquals(store_inv._byid, basis_inv._byid) |
510 | + self.assertEqual([], store_inv._make_delta(basis_inv)) |
511 | |
512 | def test_wrong_format(self): |
513 | """WorkingTree.basis safely ignores junk basis inventories""" |
514 | |
515 | === modified file 'bzrlib/tests/test_branch.py' |
516 | --- bzrlib/tests/test_branch.py 2009-07-10 05:49:34 +0000 |
517 | +++ bzrlib/tests/test_branch.py 2009-08-17 22:35:23 +0000 |
518 | @@ -40,6 +40,7 @@ |
519 | BzrBranch5, |
520 | BzrBranchFormat5, |
521 | BzrBranchFormat6, |
522 | + BzrBranchFormat7, |
523 | PullResult, |
524 | _run_with_write_locked_target, |
525 | ) |
526 | @@ -60,7 +61,7 @@ |
527 | def test_default_format(self): |
528 | # update this if you change the default branch format |
529 | self.assertIsInstance(BranchFormat.get_default_format(), |
530 | - BzrBranchFormat6) |
531 | + BzrBranchFormat7) |
532 | |
533 | def test_default_format_is_same_as_bzrdir_default(self): |
534 | # XXX: it might be nice if there was only one place the default was |
535 | |
536 | === modified file 'bzrlib/tests/test_commit.py' |
537 | --- bzrlib/tests/test_commit.py 2009-06-10 03:56:49 +0000 |
538 | +++ bzrlib/tests/test_commit.py 2009-08-17 22:35:23 +0000 |
539 | @@ -708,9 +708,10 @@ |
540 | cb = self.Callback(u'commit 2', self) |
541 | repository = tree.branch.repository |
542 | # simulate network failure |
543 | - def raise_(self, arg, arg2): |
544 | + def raise_(self, arg, arg2, arg3=None, arg4=None): |
545 | raise errors.NoSuchFile('foo') |
546 | repository.add_inventory = raise_ |
547 | + repository.add_inventory_by_delta = raise_ |
548 | self.assertRaises(errors.NoSuchFile, tree.commit, message_callback=cb) |
549 | self.assertFalse(cb.called) |
550 | |
551 | |
552 | === modified file 'bzrlib/tests/test_dirstate.py' |
553 | --- bzrlib/tests/test_dirstate.py 2009-07-15 01:13:20 +0000 |
554 | +++ bzrlib/tests/test_dirstate.py 2009-08-17 22:35:23 +0000 |
555 | @@ -419,7 +419,7 @@ |
556 | (('', '', tree.get_root_id()), # common details |
557 | [('d', '', 0, False, dirstate.DirState.NULLSTAT), # current tree |
558 | ('d', '', 0, False, rev_id), # first parent details |
559 | - ('d', '', 0, False, rev_id2), # second parent details |
560 | + ('d', '', 0, False, rev_id), # second parent details |
561 | ])]) |
562 | state = dirstate.DirState.from_tree(tree, 'dirstate') |
563 | self.check_state_with_reopen(expected_result, state) |
564 | @@ -500,7 +500,7 @@ |
565 | (('', '', tree.get_root_id()), # common details |
566 | [('d', '', 0, False, dirstate.DirState.NULLSTAT), # current tree |
567 | ('d', '', 0, False, rev_id), # first parent details |
568 | - ('d', '', 0, False, rev_id2), # second parent details |
569 | + ('d', '', 0, False, rev_id), # second parent details |
570 | ]), |
571 | (('', 'a file', 'a-file-id'), # common |
572 | [('f', '', 0, False, dirstate.DirState.NULLSTAT), # current |
573 | @@ -1000,7 +1000,7 @@ |
574 | [(('', '', root_id), [ |
575 | ('d', '', 0, False, dirstate.DirState.NULLSTAT), |
576 | ('d', '', 0, False, revid1), |
577 | - ('d', '', 0, False, revid2) |
578 | + ('d', '', 0, False, revid1) |
579 | ])], |
580 | list(state._iter_entries())) |
581 | finally: |
582 | @@ -1034,7 +1034,7 @@ |
583 | (('', '', root_id), [ |
584 | ('d', '', 0, False, dirstate.DirState.NULLSTAT), |
585 | ('d', '', 0, False, revid1.encode('utf8')), |
586 | - ('d', '', 0, False, revid2.encode('utf8')) |
587 | + ('d', '', 0, False, revid1.encode('utf8')) |
588 | ]), |
589 | (('', 'a file', 'file-id'), [ |
590 | ('a', '', 0, False, ''), |
591 | |
592 | === modified file 'bzrlib/tests/test_foreign.py' |
593 | --- bzrlib/tests/test_foreign.py 2009-08-14 04:30:32 +0000 |
594 | +++ bzrlib/tests/test_foreign.py 2009-08-17 22:35:23 +0000 |
595 | @@ -320,7 +320,7 @@ |
596 | foreign.update_workingtree_fileids(wt, target_basis) |
597 | wt.lock_read() |
598 | try: |
599 | - self.assertEquals([root_id, "bla-b"], list(wt.inventory)) |
600 | + self.assertEquals(set([root_id, "bla-b"]), set(wt.inventory)) |
601 | finally: |
602 | wt.unlock() |
603 | |
604 | |
605 | === modified file 'bzrlib/tests/test_knit.py' |
606 | --- bzrlib/tests/test_knit.py 2009-07-28 08:09:13 +0000 |
607 | +++ bzrlib/tests/test_knit.py 2009-08-17 22:35:23 +0000 |
608 | @@ -366,7 +366,7 @@ |
609 | :return: (versioned_file, reload_counter) |
610 | versioned_file a KnitVersionedFiles using the packs for access |
611 | """ |
612 | - builder = self.make_branch_builder('.') |
613 | + builder = self.make_branch_builder('.', format="1.9") |
614 | builder.start_series() |
615 | builder.build_snapshot('rev-1', None, [ |
616 | ('add', ('', 'root-id', 'directory', None)), |
617 | |
618 | === modified file 'bzrlib/tests/test_log.py' |
619 | --- bzrlib/tests/test_log.py 2009-05-08 13:39:32 +0000 |
620 | +++ bzrlib/tests/test_log.py 2009-08-17 22:35:23 +0000 |
621 | @@ -142,6 +142,9 @@ |
622 | lf = LogCatcher() |
623 | log.show_log(wt.branch, lf, verbose=True) |
624 | committed_msg = lf.revisions[0].rev.message |
625 | + if msg == committed_msg: |
626 | + raise tests.KnownFailure( |
627 | + "Commit message was preserved, but it wasn't expected to be.") |
628 | self.assertNotEqual(msg, committed_msg) |
629 | self.assertTrue(len(committed_msg) > len(msg)) |
630 | |
631 | |
632 | === modified file 'bzrlib/tests/test_remote.py' |
633 | --- bzrlib/tests/test_remote.py 2009-08-14 00:55:42 +0000 |
634 | +++ bzrlib/tests/test_remote.py 2009-08-17 22:35:23 +0000 |
635 | @@ -661,8 +661,9 @@ |
636 | network_name = reference_format.network_name() |
637 | client.add_expected_call( |
638 | 'BzrDir.create_repository', ('quack/', |
639 | - 'Bazaar pack repository format 1 (needs bzr 0.92)\n', 'False'), |
640 | - 'success', ('ok', 'no', 'no', 'no', network_name)) |
641 | + 'Bazaar repository format 2a (needs bzr 1.16 or later)\n', |
642 | + 'False'), |
643 | + 'success', ('ok', 'yes', 'yes', 'yes', network_name)) |
644 | a_bzrdir = RemoteBzrDir(transport, remote.RemoteBzrDirFormat(), |
645 | _client=client) |
646 | repo = a_bzrdir.create_repository() |
647 | @@ -670,9 +671,9 @@ |
648 | self.assertIsInstance(repo, remote.RemoteRepository) |
649 | # its format should have the settings from the response |
650 | format = repo._format |
651 | - self.assertFalse(format.rich_root_data) |
652 | - self.assertFalse(format.supports_tree_reference) |
653 | - self.assertFalse(format.supports_external_lookups) |
654 | + self.assertTrue(format.rich_root_data) |
655 | + self.assertTrue(format.supports_tree_reference) |
656 | + self.assertTrue(format.supports_external_lookups) |
657 | self.assertEqual(network_name, format.network_name()) |
658 | |
659 | |
660 | @@ -2354,6 +2355,7 @@ |
661 | """ |
662 | # Define a stream using generators so that it isn't rewindable. |
663 | inv = inventory.Inventory(revision_id='rev1') |
664 | + inv.root.revision = 'rev1' |
665 | def stream_with_inv_delta(): |
666 | yield ('inventories', inventories_substream()) |
667 | yield ('inventory-deltas', inventory_delta_substream()) |
668 | |
669 | === modified file 'bzrlib/tests/test_repository.py' |
670 | --- bzrlib/tests/test_repository.py 2009-08-14 04:11:42 +0000 |
671 | +++ bzrlib/tests/test_repository.py 2009-08-17 22:35:23 +0000 |
672 | @@ -486,6 +486,8 @@ |
673 | _serializer = None |
674 | |
675 | def supports_rich_root(self): |
676 | + if self._format is not None: |
677 | + return self._format.rich_root_data |
678 | return False |
679 | |
680 | def get_graph(self): |
681 | @@ -542,11 +544,17 @@ |
682 | # pair that it returns true on for the is_compatible static method |
683 | # check |
684 | dummy_a = DummyRepository() |
685 | + dummy_a._format = RepositoryFormat() |
686 | dummy_b = DummyRepository() |
687 | + dummy_b._format = RepositoryFormat() |
688 | repo = self.make_repository('.') |
689 | # hack dummies to look like repo somewhat. |
690 | dummy_a._serializer = repo._serializer |
691 | + dummy_a._format.supports_tree_reference = repo._format.supports_tree_reference |
692 | + dummy_a._format.rich_root_data = repo._format.rich_root_data |
693 | dummy_b._serializer = repo._serializer |
694 | + dummy_b._format.supports_tree_reference = repo._format.supports_tree_reference |
695 | + dummy_b._format.rich_root_data = repo._format.rich_root_data |
696 | repository.InterRepository.register_optimiser(InterDummy) |
697 | try: |
698 | # we should get the default for something InterDummy returns False |
699 | @@ -1033,7 +1041,7 @@ |
700 | |
701 | def make_packs_and_alt_repo(self, write_lock=False): |
702 | """Create a pack repo with 3 packs, and access it via a second repo.""" |
703 | - tree = self.make_branch_and_tree('.') |
704 | + tree = self.make_branch_and_tree('.', format=self.get_format()) |
705 | tree.lock_write() |
706 | self.addCleanup(tree.unlock) |
707 | rev1 = tree.commit('one') |
708 | @@ -1349,7 +1357,7 @@ |
709 | """Tests for the packs repository Packer class.""" |
710 | |
711 | def test_pack_optimizes_pack_order(self): |
712 | - builder = self.make_branch_builder('.') |
713 | + builder = self.make_branch_builder('.', format="1.9") |
714 | builder.start_series() |
715 | builder.build_snapshot('A', None, [ |
716 | ('add', ('', 'root-id', 'directory', None)), |
717 | |
718 | === modified file 'bzrlib/tests/test_selftest.py' |
719 | --- bzrlib/tests/test_selftest.py 2009-08-15 09:15:03 +0000 |
720 | +++ bzrlib/tests/test_selftest.py 2009-08-17 22:35:23 +0000 |
721 | @@ -40,6 +40,7 @@ |
722 | workingtree, |
723 | ) |
724 | from bzrlib.repofmt import ( |
725 | + groupcompress_repo, |
726 | pack_repo, |
727 | weaverepo, |
728 | ) |
729 | @@ -215,24 +216,24 @@ |
730 | from bzrlib.tests.per_repository import formats_to_scenarios |
731 | formats = [("(c)", remote.RemoteRepositoryFormat()), |
732 | ("(d)", repository.format_registry.get( |
733 | - 'Bazaar pack repository format 1 (needs bzr 0.92)\n'))] |
734 | + 'Bazaar repository format 2a (needs bzr 1.16 or later)\n'))] |
735 | no_vfs_scenarios = formats_to_scenarios(formats, "server", "readonly", |
736 | None) |
737 | vfs_scenarios = formats_to_scenarios(formats, "server", "readonly", |
738 | vfs_transport_factory="vfs") |
739 | # no_vfs generate scenarios without vfs_transport_factory |
740 | - self.assertEqual([ |
741 | + expected = [ |
742 | ('RemoteRepositoryFormat(c)', |
743 | {'bzrdir_format': remote.RemoteBzrDirFormat(), |
744 | 'repository_format': remote.RemoteRepositoryFormat(), |
745 | 'transport_readonly_server': 'readonly', |
746 | 'transport_server': 'server'}), |
747 | - ('RepositoryFormatKnitPack1(d)', |
748 | + ('RepositoryFormat2a(d)', |
749 | {'bzrdir_format': bzrdir.BzrDirMetaFormat1(), |
750 | - 'repository_format': pack_repo.RepositoryFormatKnitPack1(), |
751 | + 'repository_format': groupcompress_repo.RepositoryFormat2a(), |
752 | 'transport_readonly_server': 'readonly', |
753 | - 'transport_server': 'server'})], |
754 | - no_vfs_scenarios) |
755 | + 'transport_server': 'server'})] |
756 | + self.assertEqual(expected, no_vfs_scenarios) |
757 | self.assertEqual([ |
758 | ('RemoteRepositoryFormat(c)', |
759 | {'bzrdir_format': remote.RemoteBzrDirFormat(), |
760 | @@ -240,9 +241,9 @@ |
761 | 'transport_readonly_server': 'readonly', |
762 | 'transport_server': 'server', |
763 | 'vfs_transport_factory': 'vfs'}), |
764 | - ('RepositoryFormatKnitPack1(d)', |
765 | + ('RepositoryFormat2a(d)', |
766 | {'bzrdir_format': bzrdir.BzrDirMetaFormat1(), |
767 | - 'repository_format': pack_repo.RepositoryFormatKnitPack1(), |
768 | + 'repository_format': groupcompress_repo.RepositoryFormat2a(), |
769 | 'transport_readonly_server': 'readonly', |
770 | 'transport_server': 'server', |
771 | 'vfs_transport_factory': 'vfs'})], |
772 | |
773 | === modified file 'bzrlib/tests/test_smart.py' |
774 | --- bzrlib/tests/test_smart.py 2009-08-07 04:17:51 +0000 |
775 | +++ bzrlib/tests/test_smart.py 2009-08-17 22:35:23 +0000 |
776 | @@ -202,7 +202,7 @@ |
777 | self.make_bzrdir('.') |
778 | request_class = bzrlib.smart.bzrdir.SmartServerRequestCreateRepository |
779 | request = request_class(backing) |
780 | - reference_bzrdir_format = bzrdir.format_registry.get('default')() |
781 | + reference_bzrdir_format = bzrdir.format_registry.get('pack-0.92')() |
782 | reference_format = reference_bzrdir_format.repository_format |
783 | network_name = reference_format.network_name() |
784 | expected = SuccessfulSmartServerResponse( |
785 | @@ -247,17 +247,21 @@ |
786 | subtrees = 'yes' |
787 | else: |
788 | subtrees = 'no' |
789 | + if repo._format.supports_external_lookups: |
790 | + external = 'yes' |
791 | + else: |
792 | + external = 'no' |
793 | if (smart.bzrdir.SmartServerRequestFindRepositoryV3 == |
794 | self._request_class): |
795 | return SuccessfulSmartServerResponse( |
796 | - ('ok', '', rich_root, subtrees, 'no', |
797 | + ('ok', '', rich_root, subtrees, external, |
798 | repo._format.network_name())) |
799 | elif (smart.bzrdir.SmartServerRequestFindRepositoryV2 == |
800 | self._request_class): |
801 | # All tests so far are on formats, and for non-external |
802 | # repositories. |
803 | return SuccessfulSmartServerResponse( |
804 | - ('ok', '', rich_root, subtrees, 'no')) |
805 | + ('ok', '', rich_root, subtrees, external)) |
806 | else: |
807 | return SuccessfulSmartServerResponse(('ok', '', rich_root, subtrees)) |
808 | |
809 | @@ -452,7 +456,7 @@ |
810 | def test_stacked_branch(self): |
811 | """Opening a stacked branch does not open the stacked-on branch.""" |
812 | trunk = self.make_branch('trunk') |
813 | - feature = self.make_branch('feature', format='1.9') |
814 | + feature = self.make_branch('feature') |
815 | feature.set_stacked_on_url(trunk.base) |
816 | opened_branches = [] |
817 | Branch.hooks.install_named_hook('open', opened_branches.append, None) |
818 | |
819 | === modified file 'bzrlib/tests/test_version_info.py' |
820 | --- bzrlib/tests/test_version_info.py 2009-04-06 02:54:14 +0000 |
821 | +++ bzrlib/tests/test_version_info.py 2009-08-17 22:35:23 +0000 |
822 | @@ -148,12 +148,11 @@ |
823 | stanza = regen(check_for_clean=True, include_file_revisions=True) |
824 | self.assertEqual(['False'], stanza.get_all('clean')) |
825 | |
826 | - # XXX: This assumes it's being run against a repository that updates |
827 | - # the root revision on every commit. Newer ones that use |
828 | - # RootCommitBuilder won't update it on each commit. |
829 | + # This assumes it's being run against a tree that does not update the |
830 | + # root revision on every commit. |
831 | file_rev_stanza = get_one_stanza(stanza, 'file-revisions') |
832 | self.assertEqual(['', 'a', 'b', 'c'], file_rev_stanza.get_all('path')) |
833 | - self.assertEqual(['r3', 'r3', 'r2', 'unversioned'], |
834 | + self.assertEqual(['r1', 'r3', 'r2', 'unversioned'], |
835 | file_rev_stanza.get_all('revision')) |
836 | os.remove('branch/c') |
837 | |
838 | @@ -171,7 +170,7 @@ |
839 | file_rev_stanza = get_one_stanza(stanza, 'file-revisions') |
840 | self.assertEqual(['', 'a', 'b', 'c', 'd'], |
841 | file_rev_stanza.get_all('path')) |
842 | - self.assertEqual(['r3', 'modified', 'renamed to d', 'new', |
843 | + self.assertEqual(['r1', 'modified', 'renamed to d', 'new', |
844 | 'renamed from b'], |
845 | file_rev_stanza.get_all('revision')) |
846 | |
847 | @@ -181,7 +180,7 @@ |
848 | stanza = regen(check_for_clean=True, include_file_revisions=True) |
849 | file_rev_stanza = get_one_stanza(stanza, 'file-revisions') |
850 | self.assertEqual(['', 'a', 'c', 'd'], file_rev_stanza.get_all('path')) |
851 | - self.assertEqual(['r4', 'r4', 'unversioned', 'removed'], |
852 | + self.assertEqual(['r1', 'r4', 'unversioned', 'removed'], |
853 | file_rev_stanza.get_all('revision')) |
854 | |
855 | def test_python_null(self): |
856 | |
857 | === modified file 'bzrlib/workingtree.py' |
858 | --- bzrlib/workingtree.py 2009-08-04 04:36:34 +0000 |
859 | +++ bzrlib/workingtree.py 2009-08-17 22:35:23 +0000 |
860 | @@ -1893,8 +1893,8 @@ |
861 | firstline = xml.split('\n', 1)[0] |
862 | if (not 'revision_id="' in firstline or |
863 | 'format="7"' not in firstline): |
864 | - inv = self.branch.repository.deserialise_inventory( |
865 | - new_revision, xml) |
866 | + inv = self.branch.repository._serializer.read_inventory_from_string( |
867 | + xml, new_revision) |
868 | xml = self._create_basis_xml_from_inventory(new_revision, inv) |
869 | self._write_basis_inventory(xml) |
870 | except (errors.NoSuchRevision, errors.RevisionNotPresent): |
871 | @@ -3030,10 +3030,10 @@ |
872 | return self.get_format_string() |
873 | |
874 | |
875 | -__default_format = WorkingTreeFormat4() |
876 | +__default_format = WorkingTreeFormat6() |
877 | WorkingTreeFormat.register_format(__default_format) |
878 | -WorkingTreeFormat.register_format(WorkingTreeFormat6()) |
879 | WorkingTreeFormat.register_format(WorkingTreeFormat5()) |
880 | +WorkingTreeFormat.register_format(WorkingTreeFormat4()) |
881 | WorkingTreeFormat.register_format(WorkingTreeFormat3()) |
882 | WorkingTreeFormat.set_default_format(__default_format) |
883 | # formats which have no format string are not discoverable |
This makes 2a the default format.
The web diff will be overly large - there are many approved components
of this branch currently landing on PQM.
So to review, you'll probably want to pull my bzr.dev once the current
branch has landed and merge. I'll do that myself and update the branch,
but even the lp will take hours to get up to speed.