664
665
self.assertFalse(repo._format.supports_external_lookups)
668
class TestDevelopment5(TestCaseWithTransport):
670
def test_inventories_use_chk_map_with_parent_base_dict(self):
671
tree = self.make_branch_and_tree('repo', format="development5")
672
revid = tree.commit("foo")
674
self.addCleanup(tree.unlock)
675
inv = tree.branch.repository.get_inventory(revid)
676
self.assertNotEqual(None, inv.parent_id_basename_to_file_id)
677
inv.parent_id_basename_to_file_id._ensure_root()
678
inv.id_to_entry._ensure_root()
679
self.assertEqual(4096, inv.id_to_entry._root_node.maximum_size)
680
self.assertEqual(4096,
681
inv.parent_id_basename_to_file_id._root_node.maximum_size)
684
class TestDevelopment5FindRevisionOutsideSet(TestCaseWithTransport):
685
"""Tests for _find_revision_outside_set."""
688
super(TestDevelopment5FindRevisionOutsideSet, self).setUp()
689
self.builder = self.make_branch_builder('source', format='development5')
690
self.builder.start_series()
691
self.builder.build_snapshot('initial', None,
692
[('add', ('', 'tree-root', 'directory', None))])
693
self.repo = self.builder.get_branch().repository
694
self.addCleanup(self.builder.finish_series)
696
def assertRevisionOutsideSet(self, expected_result, rev_set):
698
expected_result, self.repo._find_revision_outside_set(rev_set))
700
def test_simple(self):
701
self.builder.build_snapshot('revid1', None, [])
702
self.builder.build_snapshot('revid2', None, [])
704
self.assertRevisionOutsideSet('revid1', rev_set)
706
def test_not_first_parent(self):
707
self.builder.build_snapshot('revid1', None, [])
708
self.builder.build_snapshot('revid2', None, [])
709
self.builder.build_snapshot('revid3', None, [])
710
rev_set = ['revid3', 'revid2']
711
self.assertRevisionOutsideSet('revid1', rev_set)
713
def test_not_null(self):
714
rev_set = ['initial']
715
self.assertRevisionOutsideSet(_mod_revision.NULL_REVISION, rev_set)
717
def test_not_null_set(self):
718
self.builder.build_snapshot('revid1', None, [])
719
rev_set = [_mod_revision.NULL_REVISION]
720
self.assertRevisionOutsideSet(_mod_revision.NULL_REVISION, rev_set)
722
def test_ghost(self):
723
self.builder.build_snapshot('revid1', None, [])
724
rev_set = ['ghost', 'revid1']
725
self.assertRevisionOutsideSet('initial', rev_set)
727
def test_ghost_parent(self):
728
self.builder.build_snapshot('revid1', None, [])
729
self.builder.build_snapshot('revid2', ['revid1', 'ghost'], [])
730
rev_set = ['revid2', 'revid1']
731
self.assertRevisionOutsideSet('initial', rev_set)
733
def test_righthand_parent(self):
734
self.builder.build_snapshot('revid1', None, [])
735
self.builder.build_snapshot('revid2a', ['revid1'], [])
736
self.builder.build_snapshot('revid2b', ['revid1'], [])
737
self.builder.build_snapshot('revid3', ['revid2a', 'revid2b'], [])
738
rev_set = ['revid3', 'revid2a']
739
self.assertRevisionOutsideSet('revid2b', rev_set)
667
742
class TestWithBrokenRepo(TestCaseWithTransport):
668
743
"""These tests seem to be more appropriate as interface tests?"""
1050
1125
pack_transport = self.get_transport('pack')
1051
1126
index_transport = self.get_transport('index')
1052
1127
upload_transport.mkdir('.')
1053
collection = pack_repo.RepositoryPackCollection(repo=None,
1128
collection = pack_repo.RepositoryPackCollection(
1054
1130
transport=self.get_transport('.'),
1055
1131
index_transport=index_transport,
1056
1132
upload_transport=upload_transport,
1057
1133
pack_transport=pack_transport,
1058
1134
index_builder_class=BTreeBuilder,
1059
index_class=BTreeGraphIndex)
1135
index_class=BTreeGraphIndex,
1136
use_chk_index=False)
1060
1137
pack = pack_repo.NewPack(collection)
1061
1138
self.assertIsInstance(pack.revision_index, BTreeBuilder)
1062
1139
self.assertIsInstance(pack.inventory_index, BTreeBuilder)