65
65
"""Packs do not need ordered data retrieval."""
66
66
format = self.get_format()
67
67
repo = self.make_repository('.', format=format)
68
self.assertEqual('unsorted', repo._fetch_order)
68
self.assertEqual('unordered', repo._fetch_order)
70
70
def test_attribute__fetch_uses_deltas(self):
71
71
"""Packs reuse deltas."""
413
413
def test_break_lock_breaks_physical_lock(self):
414
414
repo = self.make_repository('.', format=self.get_format())
415
415
repo._pack_collection.lock_names()
416
repo.control_files.leave_in_place()
416
418
repo2 = repository.Repository.open('.')
417
419
self.assertTrue(repo.get_physical_lock_status())
418
420
self.prepare_for_break_lock()
495
497
def get_format(self):
496
498
return bzrdir.format_registry.make_bzrdir(self.format_name)
498
def test_stack_checks_compatibility(self):
500
def test_stack_checks_rich_root_compatibility(self):
499
501
# early versions of the packing code relied on pack internals to
500
502
# stack, but the current version should be able to stack on any
507
509
if repo.supports_rich_root():
508
510
# can only stack on repositories that have compatible internal
510
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'
511
516
mismatching_format_name = 'pack-0.92'
513
518
matching_format_name = 'pack-0.92'
524
529
r'KnitPackRepository.*/repo/.*\n'
525
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')
527
558
def test_adding_pack_does_not_record_pack_names_from_other_repositories(self):
528
559
base = self.make_branch_and_tree('base', format=self.get_format())
529
560
base.commit('foo')
590
621
dict(format_name='1.6',
591
622
format_string="Bazaar RepositoryFormatKnitPack5 (bzr 1.6)\n",
592
623
format_supports_external_lookups=True),
593
dict(format_name='1.6-rich-root',
624
dict(format_name='1.6.1-rich-root',
594
625
format_string="Bazaar RepositoryFormatKnitPack5RichRoot "
596
627
format_supports_external_lookups=True),
597
628
dict(format_name='development0',
598
629
format_string="Bazaar development format 0 "