664
670
self.assertFalse(repo._format.supports_external_lookups)
673
class TestDevelopment6(TestCaseWithTransport):
675
def test_inventories_use_chk_map_with_parent_base_dict(self):
676
tree = self.make_branch_and_tree('repo', format="development6-rich-root")
677
revid = tree.commit("foo")
679
self.addCleanup(tree.unlock)
680
inv = tree.branch.repository.get_inventory(revid)
681
self.assertNotEqual(None, inv.parent_id_basename_to_file_id)
682
inv.parent_id_basename_to_file_id._ensure_root()
683
inv.id_to_entry._ensure_root()
684
self.assertEqual(65536, inv.id_to_entry._root_node.maximum_size)
685
self.assertEqual(65536,
686
inv.parent_id_basename_to_file_id._root_node.maximum_size)
689
class TestDevelopment6FindRevisionOutsideSet(TestCaseWithTransport):
690
"""Tests for _find_revision_outside_set."""
693
super(TestDevelopment6FindRevisionOutsideSet, self).setUp()
694
self.builder = self.make_branch_builder('source',
695
format='development6-rich-root')
696
self.builder.start_series()
697
self.builder.build_snapshot('initial', None,
698
[('add', ('', 'tree-root', 'directory', None))])
699
self.repo = self.builder.get_branch().repository
700
self.addCleanup(self.builder.finish_series)
702
def assertRevisionOutsideSet(self, expected_result, rev_set):
704
expected_result, self.repo._find_revision_outside_set(rev_set))
706
def test_simple(self):
707
self.builder.build_snapshot('revid1', None, [])
708
self.builder.build_snapshot('revid2', None, [])
710
self.assertRevisionOutsideSet('revid1', rev_set)
712
def test_not_first_parent(self):
713
self.builder.build_snapshot('revid1', None, [])
714
self.builder.build_snapshot('revid2', None, [])
715
self.builder.build_snapshot('revid3', None, [])
716
rev_set = ['revid3', 'revid2']
717
self.assertRevisionOutsideSet('revid1', rev_set)
719
def test_not_null(self):
720
rev_set = ['initial']
721
self.assertRevisionOutsideSet(_mod_revision.NULL_REVISION, rev_set)
723
def test_not_null_set(self):
724
self.builder.build_snapshot('revid1', None, [])
725
rev_set = [_mod_revision.NULL_REVISION]
726
self.assertRevisionOutsideSet(_mod_revision.NULL_REVISION, rev_set)
728
def test_ghost(self):
729
self.builder.build_snapshot('revid1', None, [])
730
rev_set = ['ghost', 'revid1']
731
self.assertRevisionOutsideSet('initial', rev_set)
733
def test_ghost_parent(self):
734
self.builder.build_snapshot('revid1', None, [])
735
self.builder.build_snapshot('revid2', ['revid1', 'ghost'], [])
736
rev_set = ['revid2', 'revid1']
737
self.assertRevisionOutsideSet('initial', rev_set)
739
def test_righthand_parent(self):
740
self.builder.build_snapshot('revid1', None, [])
741
self.builder.build_snapshot('revid2a', ['revid1'], [])
742
self.builder.build_snapshot('revid2b', ['revid1'], [])
743
self.builder.build_snapshot('revid3', ['revid2a', 'revid2b'], [])
744
rev_set = ['revid3', 'revid2a']
745
self.assertRevisionOutsideSet('revid2b', rev_set)
667
748
class TestWithBrokenRepo(TestCaseWithTransport):
668
749
"""These tests seem to be more appropriate as interface tests?"""
1050
1131
pack_transport = self.get_transport('pack')
1051
1132
index_transport = self.get_transport('index')
1052
1133
upload_transport.mkdir('.')
1053
collection = pack_repo.RepositoryPackCollection(repo=None,
1134
collection = pack_repo.RepositoryPackCollection(
1054
1136
transport=self.get_transport('.'),
1055
1137
index_transport=index_transport,
1056
1138
upload_transport=upload_transport,
1057
1139
pack_transport=pack_transport,
1058
1140
index_builder_class=BTreeBuilder,
1059
index_class=BTreeGraphIndex)
1141
index_class=BTreeGraphIndex,
1142
use_chk_index=False)
1060
1143
pack = pack_repo.NewPack(collection)
1061
1144
self.assertIsInstance(pack.revision_index, BTreeBuilder)
1062
1145
self.assertIsInstance(pack.inventory_index, BTreeBuilder)
1121
1204
self.assertTrue(new_pack.inventory_index._optimize_for_size)
1122
1205
self.assertTrue(new_pack.text_index._optimize_for_size)
1123
1206
self.assertTrue(new_pack.signature_index._optimize_for_size)
1209
class TestGCCHKPackCollection(TestCaseWithTransport):
1211
def test_stream_source_to_gc(self):
1212
source = self.make_repository('source', format='development6-rich-root')
1213
target = self.make_repository('target', format='development6-rich-root')
1214
stream = source._get_source(target._format)
1215
self.assertIsInstance(stream, groupcompress_repo.GroupCHKStreamSource)
1217
def test_stream_source_to_non_gc(self):
1218
source = self.make_repository('source', format='development6-rich-root')
1219
target = self.make_repository('target', format='rich-root-pack')
1220
stream = source._get_source(target._format)
1221
# We don't want the child GroupCHKStreamSource
1222
self.assertIs(type(stream), repository.StreamSource)