497
497
def get_format(self):
498
498
return bzrdir.format_registry.make_bzrdir(self.format_name)
500
def test_stack_checks_compatibility(self):
500
def test_stack_checks_rich_root_compatibility(self):
501
501
# early versions of the packing code relied on pack internals to
502
502
# stack, but the current version should be able to stack on any
509
509
if repo.supports_rich_root():
510
510
# can only stack on repositories that have compatible internal
512
matching_format_name = 'pack-0.92-subtree'
512
if getattr(repo._format, 'supports_tree_reference', False):
513
matching_format_name = 'pack-0.92-subtree'
515
matching_format_name = 'rich-root-pack'
513
516
mismatching_format_name = 'pack-0.92'
515
518
matching_format_name = 'pack-0.92'
526
529
r'KnitPackRepository.*/repo/.*\n'
527
530
r'different rich-root support')
532
def test_stack_checks_serializers_compatibility(self):
533
repo = self.make_repository('repo', format=self.get_format())
534
if getattr(repo._format, 'supports_tree_reference', False):
535
# can only stack on repositories that have compatible internal
537
matching_format_name = 'pack-0.92-subtree'
538
mismatching_format_name = 'rich-root-pack'
540
if repo.supports_rich_root():
541
matching_format_name = 'rich-root-pack'
542
mismatching_format_name = 'pack-0.92-subtree'
544
raise TestNotApplicable('No formats use non-v5 serializer'
545
' without having rich-root also set')
546
base = self.make_repository('base', format=matching_format_name)
547
repo.add_fallback_repository(base)
548
# you can't stack on something with incompatible data
549
bad_repo = self.make_repository('mismatch',
550
format=mismatching_format_name)
551
e = self.assertRaises(errors.IncompatibleRepositories,
552
repo.add_fallback_repository, bad_repo)
553
self.assertContainsRe(str(e),
554
r'(?m)KnitPackRepository.*/mismatch/.*\nis not compatible with\n'
555
r'KnitPackRepository.*/repo/.*\n'
556
r'different serializers')
529
558
def test_adding_pack_does_not_record_pack_names_from_other_repositories(self):
530
559
base = self.make_branch_and_tree('base', format=self.get_format())
531
560
base.commit('foo')
592
621
dict(format_name='1.6',
593
622
format_string="Bazaar RepositoryFormatKnitPack5 (bzr 1.6)\n",
594
623
format_supports_external_lookups=True),
595
dict(format_name='1.6-rich-root',
624
dict(format_name='1.6.1-rich-root',
596
625
format_string="Bazaar RepositoryFormatKnitPack5RichRoot "
598
627
format_supports_external_lookups=True),
599
628
dict(format_name='development0',
600
629
format_string="Bazaar development format 0 "