/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_repository.py

  • Committer: Lukáš Lalinský
  • Date: 2007-12-17 17:28:25 UTC
  • mfrom: (3120 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3123.
  • Revision ID: lalinsky@gmail.com-20071217172825-tr3pqm1mhvs3gwnn
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
432
432
            ('text-d', ['text-c'], test_knit.TEXT_1),
433
433
            ('text-m', ['text-b', 'text-d'], test_knit.TEXT_1),
434
434
           ]
 
435
        # This test is actually a bit strict as the order in which they're
 
436
        # returned is not defined.  This matches the current (deterministic)
 
437
        # behaviour.
435
438
        expected_data_list = [
436
439
            # version, options, parents
437
440
            ('text-a', ['fulltext'], []),
438
441
            ('text-b', ['line-delta'], ['text-a']),
 
442
            ('text-m', ['line-delta'], ['text-b', 'text-d']),
439
443
            ('text-c', ['fulltext'], []),
440
444
            ('text-d', ['line-delta'], ['text-c']),
441
 
            ('text-m', ['line-delta'], ['text-b', 'text-d']),
442
445
            ]
443
446
        for version_id, parents, lines in test_data:
444
447
            k1.add_lines(version_id, parents, test_knit.split_lines(lines))
445
448
 
446
449
        bytes = knitrepo._get_stream_as_bytes(
447
 
            k1, ['text-a', 'text-b', 'text-c', 'text-d', 'text-m'])
 
450
            k1, ['text-a', 'text-b', 'text-m', 'text-c', 'text-d', ])
448
451
 
449
452
        data = bencode.bdecode(bytes)
450
453
        format = data.pop(0)
765
768
class TestKnitPackNoSubtrees(TestCaseWithTransport):
766
769
 
767
770
    def get_format(self):
768
 
        return bzrdir.format_registry.make_bzrdir('knitpack-experimental')
 
771
        return bzrdir.format_registry.make_bzrdir('pack-0.92')
769
772
 
770
773
    def test_disk_layout(self):
771
774
        format = self.get_format()
926
929
        self.assertEqual(1, len(list(index.iter_all_entries())))
927
930
        self.assertEqual(2, len(tree.branch.repository.all_revision_ids()))
928
931
 
 
932
    def test_pack_layout(self):
 
933
        format = self.get_format()
 
934
        tree = self.make_branch_and_tree('.', format=format)
 
935
        trans = tree.branch.repository.bzrdir.get_repository_transport(None)
 
936
        tree.commit('start', rev_id='1')
 
937
        tree.commit('more work', rev_id='2')
 
938
        tree.branch.repository.pack()
 
939
        tree.lock_read()
 
940
        self.addCleanup(tree.unlock)
 
941
        pack = tree.branch.repository._pack_collection.get_pack_by_name(
 
942
            tree.branch.repository._pack_collection.names()[0])
 
943
        # revision access tends to be tip->ancestor, so ordering that way on 
 
944
        # disk is a good idea.
 
945
        for _1, key, val, refs in pack.revision_index.iter_all_entries():
 
946
            if key == ('1',):
 
947
                pos_1 = int(val[1:].split()[0])
 
948
            else:
 
949
                pos_2 = int(val[1:].split()[0])
 
950
        self.assertTrue(pos_2 < pos_1)
 
951
 
929
952
    def test_pack_repositories_support_multiple_write_locks(self):
930
953
        format = self.get_format()
931
954
        self.make_repository('.', shared=True, format=format)
1147
1170
 
1148
1171
    def get_format(self):
1149
1172
        return bzrdir.format_registry.make_bzrdir(
1150
 
            'knitpack-subtree-experimental')
 
1173
            'pack-0.92-subtree')
1151
1174
 
1152
1175
    def check_format(self, t):
1153
1176
        self.assertEqualDiff(
1158
1181
class TestRepositoryPackCollection(TestCaseWithTransport):
1159
1182
 
1160
1183
    def get_format(self):
1161
 
        return bzrdir.format_registry.make_bzrdir('knitpack-experimental')
 
1184
        return bzrdir.format_registry.make_bzrdir('pack-0.92')
1162
1185
 
1163
1186
    def test__max_pack_count(self):
1164
1187
        """The maximum pack count is a function of the number of revisions."""
1192
1215
        repo = self.make_repository('.', format=format)
1193
1216
        packs = repo._pack_collection
1194
1217
        self.assertEqual([0], packs.pack_distribution(0))
1195
 
        
 
1218
 
 
1219
    def test_ensure_loaded_unlocked(self):
 
1220
        format = self.get_format()
 
1221
        repo = self.make_repository('.', format=format)
 
1222
        self.assertRaises(errors.ObjectNotLocked,
 
1223
                          repo._pack_collection.ensure_loaded)
 
1224
 
1196
1225
    def test_pack_distribution_one_to_nine(self):
1197
1226
        format = self.get_format()
1198
1227
        repo = self.make_repository('.', format=format)