/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

merge bzr.dev r3564

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
from bzrlib.tests import (
40
40
    TestCase,
41
41
    TestCaseWithTransport,
 
42
    TestSkipped,
42
43
    test_knit,
43
44
    )
44
 
from bzrlib.transport import get_transport
 
45
from bzrlib.transport import (
 
46
    fakenfs,
 
47
    get_transport,
 
48
    )
45
49
from bzrlib.transport.memory import MemoryServer
46
50
from bzrlib.util import bencode
47
51
from bzrlib import (
167
171
                          control.transport.get,
168
172
                          'ancestry.weave')
169
173
 
170
 
    def test_exposed_versioned_files_are_marked_dirty(self):
171
 
        control = bzrdir.BzrDirFormat6().initialize(self.get_url())
172
 
        repo = weaverepo.RepositoryFormat6().initialize(control)
173
 
        repo.lock_write()
174
 
        inv = repo.get_inventory_weave()
175
 
        repo.unlock()
176
 
        self.assertRaises(errors.OutSideTransaction,
177
 
            inv.add_lines, 'foo', [], [])
178
 
 
179
174
    def test_supports_external_lookups(self):
180
175
        control = bzrdir.BzrDirFormat6().initialize(self.get_url())
181
176
        repo = weaverepo.RepositoryFormat6().initialize(control)
205
200
                             'w\n'
206
201
                             'W\n',
207
202
                             t.get('inventory.weave').read())
 
203
        # Creating a file with id Foo:Bar results in a non-escaped file name on
 
204
        # disk.
 
205
        control.create_branch()
 
206
        tree = control.create_workingtree()
 
207
        tree.add(['foo'], ['Foo:Bar'], ['file'])
 
208
        tree.put_file_bytes_non_atomic('Foo:Bar', 'content\n')
 
209
        tree.commit('first post', rev_id='first')
 
210
        self.assertEqualDiff(
 
211
            '# bzr weave file v5\n'
 
212
            'i\n'
 
213
            '1 7fe70820e08a1aac0ef224d9c66ab66831cc4ab1\n'
 
214
            'n first\n'
 
215
            '\n'
 
216
            'w\n'
 
217
            '{ 0\n'
 
218
            '. content\n'
 
219
            '}\n'
 
220
            'W\n',
 
221
            t.get('weaves/74/Foo%3ABar.weave').read())
208
222
 
209
223
    def test_shared_disk_layout(self):
210
224
        control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
285
299
                             'W\n',
286
300
                             t.get('inventory.weave').read())
287
301
 
288
 
    def test_exposed_versioned_files_are_marked_dirty(self):
289
 
        control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
290
 
        repo = weaverepo.RepositoryFormat7().initialize(control)
291
 
        repo.lock_write()
292
 
        inv = repo.get_inventory_weave()
293
 
        repo.unlock()
294
 
        self.assertRaises(errors.OutSideTransaction,
295
 
            inv.add_lines, 'foo', [], [])
296
 
 
297
302
    def test_supports_external_lookups(self):
298
303
        control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
299
304
        repo = weaverepo.RepositoryFormat7().initialize(control)
321
326
        # self.assertEqualDiff('', t.get('lock').read())
322
327
        self.assertTrue(S_ISDIR(t.stat('knits').st_mode))
323
328
        self.check_knits(t)
 
329
        # Check per-file knits.
 
330
        branch = control.create_branch()
 
331
        tree = control.create_workingtree()
 
332
        tree.add(['foo'], ['Nasty-IdC:'], ['file'])
 
333
        tree.put_file_bytes_non_atomic('Nasty-IdC:', '')
 
334
        tree.commit('1st post', rev_id='foo')
 
335
        self.assertHasKnit(t, 'knits/e8/%254easty-%2549d%2543%253a',
 
336
            '\nfoo fulltext 0 81  :')
324
337
 
325
 
    def assertHasKnit(self, t, knit_name):
 
338
    def assertHasKnit(self, t, knit_name, extra_content=''):
326
339
        """Assert that knit_name exists on t."""
327
 
        self.assertEqualDiff('# bzr knit index 8\n',
 
340
        self.assertEqualDiff('# bzr knit index 8\n' + extra_content,
328
341
                             t.get(knit_name + '.kndx').read())
329
 
        # no default content
330
 
        self.assertTrue(t.has(knit_name + '.knit'))
331
342
 
332
343
    def check_knits(self, t):
333
344
        """check knit content for a repository."""
377
388
        self.assertTrue(S_ISDIR(t.stat('knits').st_mode))
378
389
        self.check_knits(t)
379
390
 
380
 
    def test_exposed_versioned_files_are_marked_dirty(self):
381
 
        format = bzrdir.BzrDirMetaFormat1()
382
 
        format.repository_format = knitrepo.RepositoryFormatKnit1()
383
 
        repo = self.make_repository('.', format=format)
384
 
        repo.lock_write()
385
 
        inv = repo.get_inventory_weave()
386
 
        repo.unlock()
387
 
        self.assertRaises(errors.OutSideTransaction,
388
 
            inv.add_lines, 'foo', [], [])
389
 
 
390
391
    def test_deserialise_sets_root_revision(self):
391
392
        """We must have a inventory.root.revision
392
393
 
420
421
        self.assertFalse(repo._format.supports_external_lookups)
421
422
 
422
423
 
423
 
class KnitRepositoryStreamTests(test_knit.KnitTests):
424
 
    """Tests for knitrepo._get_stream_as_bytes."""
425
 
 
426
 
    def test_get_stream_as_bytes(self):
427
 
        # Make a simple knit
428
 
        k1 = self.make_test_knit()
429
 
        k1.add_lines('text-a', [], test_knit.split_lines(test_knit.TEXT_1))
430
 
        
431
 
        # Serialise it, check the output.
432
 
        bytes = knitrepo._get_stream_as_bytes(k1, ['text-a'])
433
 
        data = bencode.bdecode(bytes)
434
 
        format, record = data
435
 
        self.assertEqual('knit-plain', format)
436
 
        self.assertEqual(['text-a', ['fulltext'], []], record[:3])
437
 
        self.assertRecordContentEqual(k1, 'text-a', record[3])
438
 
 
439
 
    def test_get_stream_as_bytes_all(self):
440
 
        """Get a serialised data stream for all the records in a knit.
441
 
 
442
 
        Much like test_get_stream_all, except for get_stream_as_bytes.
443
 
        """
444
 
        k1 = self.make_test_knit()
445
 
        # Insert the same data as BasicKnitTests.test_knit_join, as they seem
446
 
        # to cover a range of cases (no parents, one parent, multiple parents).
447
 
        test_data = [
448
 
            ('text-a', [], test_knit.TEXT_1),
449
 
            ('text-b', ['text-a'], test_knit.TEXT_1),
450
 
            ('text-c', [], test_knit.TEXT_1),
451
 
            ('text-d', ['text-c'], test_knit.TEXT_1),
452
 
            ('text-m', ['text-b', 'text-d'], test_knit.TEXT_1),
453
 
           ]
454
 
        # This test is actually a bit strict as the order in which they're
455
 
        # returned is not defined.  This matches the current (deterministic)
456
 
        # behaviour.
457
 
        expected_data_list = [
458
 
            # version, options, parents
459
 
            ('text-a', ['fulltext'], []),
460
 
            ('text-b', ['line-delta'], ['text-a']),
461
 
            ('text-m', ['line-delta'], ['text-b', 'text-d']),
462
 
            ('text-c', ['fulltext'], []),
463
 
            ('text-d', ['line-delta'], ['text-c']),
464
 
            ]
465
 
        for version_id, parents, lines in test_data:
466
 
            k1.add_lines(version_id, parents, test_knit.split_lines(lines))
467
 
 
468
 
        bytes = knitrepo._get_stream_as_bytes(
469
 
            k1, ['text-a', 'text-b', 'text-m', 'text-c', 'text-d', ])
470
 
 
471
 
        data = bencode.bdecode(bytes)
472
 
        format = data.pop(0)
473
 
        self.assertEqual('knit-plain', format)
474
 
 
475
 
        for expected, actual in zip(expected_data_list, data):
476
 
            expected_version = expected[0]
477
 
            expected_options = expected[1]
478
 
            expected_parents = expected[2]
479
 
            version, options, parents, bytes = actual
480
 
            self.assertEqual(expected_version, version)
481
 
            self.assertEqual(expected_options, options)
482
 
            self.assertEqual(expected_parents, parents)
483
 
            self.assertRecordContentEqual(k1, version, bytes)
484
 
 
485
 
 
486
424
class DummyRepository(object):
487
425
    """A dummy repository for testing."""
488
426
 
593
531
                                                        repo_b).__class__)
594
532
 
595
533
 
596
 
class TestInterRemoteToOther(TestCaseWithTransport):
597
 
 
598
 
    def make_remote_repository(self, path, backing_format=None):
599
 
        """Make a RemoteRepository object backed by a real repository that will
600
 
        be created at the given path."""
601
 
        self.make_repository(path, format=backing_format)
602
 
        smart_server = server.SmartTCPServer_for_testing()
603
 
        smart_server.setUp()
604
 
        remote_transport = get_transport(smart_server.get_url()).clone(path)
605
 
        self.addCleanup(smart_server.tearDown)
606
 
        remote_bzrdir = bzrdir.BzrDir.open_from_transport(remote_transport)
607
 
        remote_repo = remote_bzrdir.open_repository()
608
 
        return remote_repo
609
 
 
610
 
    def test_is_compatible_same_format(self):
611
 
        """InterRemoteToOther is compatible with a remote repository and a
612
 
        second repository that have the same format."""
613
 
        local_repo = self.make_repository('local')
614
 
        remote_repo = self.make_remote_repository('remote')
615
 
        is_compatible = repository.InterRemoteToOther.is_compatible
616
 
        self.assertTrue(
617
 
            is_compatible(remote_repo, local_repo),
618
 
            "InterRemoteToOther(%r, %r) is false" % (remote_repo, local_repo))
619
 
          
620
 
    def test_is_incompatible_different_format(self):
621
 
        local_repo = self.make_repository('local', 'dirstate')
622
 
        remote_repo = self.make_remote_repository('a', 'dirstate-with-subtree')
623
 
        is_compatible = repository.InterRemoteToOther.is_compatible
624
 
        self.assertFalse(
625
 
            is_compatible(remote_repo, local_repo),
626
 
            "InterRemoteToOther(%r, %r) is true" % (local_repo, remote_repo))
627
 
 
628
 
    def test_is_incompatible_different_format_both_remote(self):
629
 
        remote_repo_a = self.make_remote_repository(
630
 
            'a', 'dirstate-with-subtree')
631
 
        remote_repo_b = self.make_remote_repository('b', 'dirstate')
632
 
        is_compatible = repository.InterRemoteToOther.is_compatible
633
 
        self.assertFalse(
634
 
            is_compatible(remote_repo_a, remote_repo_b),
635
 
            "InterRemoteToOther(%r, %r) is true"
636
 
            % (remote_repo_a, remote_repo_b))
637
 
 
638
 
 
639
534
class TestRepositoryConverter(TestCaseWithTransport):
640
535
 
641
536
    def test_convert_empty(self):
670
565
        tree = self.make_branch_and_tree('.', format)
671
566
        tree.commit("Dull commit", rev_id="dull")
672
567
        revision_tree = tree.branch.repository.revision_tree('dull')
673
 
        self.assertRaises(errors.NoSuchFile, revision_tree.get_file_lines,
674
 
            revision_tree.inventory.root.file_id)
 
568
        revision_tree.lock_read()
 
569
        try:
 
570
            self.assertRaises(errors.NoSuchFile, revision_tree.get_file_lines,
 
571
                revision_tree.inventory.root.file_id)
 
572
        finally:
 
573
            revision_tree.unlock()
675
574
        format = bzrdir.BzrDirMetaFormat1()
676
575
        format.repository_format = knitrepo.RepositoryFormatKnit3()
677
576
        upgrade.Convert('.', format)
678
577
        tree = workingtree.WorkingTree.open('.')
679
578
        revision_tree = tree.branch.repository.revision_tree('dull')
680
 
        revision_tree.get_file_lines(revision_tree.inventory.root.file_id)
 
579
        revision_tree.lock_read()
 
580
        try:
 
581
            revision_tree.get_file_lines(revision_tree.inventory.root.file_id)
 
582
        finally:
 
583
            revision_tree.unlock()
681
584
        tree.commit("Another dull commit", rev_id='dull2')
682
585
        revision_tree = tree.branch.repository.revision_tree('dull2')
 
586
        revision_tree.lock_read()
 
587
        self.addCleanup(revision_tree.unlock)
683
588
        self.assertEqual('dull', revision_tree.inventory.root.revision)
684
589
 
685
 
    def test_exposed_versioned_files_are_marked_dirty(self):
686
 
        format = bzrdir.BzrDirMetaFormat1()
687
 
        format.repository_format = knitrepo.RepositoryFormatKnit3()
688
 
        repo = self.make_repository('.', format=format)
689
 
        repo.lock_write()
690
 
        inv = repo.get_inventory_weave()
691
 
        repo.unlock()
692
 
        self.assertRaises(errors.OutSideTransaction,
693
 
            inv.add_lines, 'foo', [], [])
694
 
 
695
590
    def test_supports_external_lookups(self):
696
591
        format = bzrdir.BzrDirMetaFormat1()
697
592
        format.repository_format = knitrepo.RepositoryFormatKnit3()
769
664
        entry.revision = revision
770
665
        entry.text_size = 0
771
666
        inv.add(entry)
772
 
        vf = repo.weave_store.get_weave_or_empty(file_id,
773
 
                                                 repo.get_transaction())
774
 
        vf.add_lines(revision, parents, ['line\n'])
 
667
        text_key = (file_id, revision)
 
668
        parent_keys = [(file_id, parent) for parent in parents]
 
669
        repo.texts.add_lines(text_key, parent_keys, ['line\n'])
775
670
 
776
671
    def test_insert_from_broken_repo(self):
777
672
        """Inserting a data stream from a broken repository won't silently
779
674
        """
780
675
        broken_repo = self.make_broken_repository()
781
676
        empty_repo = self.make_repository('empty-repo')
782
 
        search = graph.SearchResult(set(['rev1a', 'rev2', 'rev3']),
783
 
            set(), 3, ['rev1a', 'rev2', 'rev3'])
784
 
        broken_repo.lock_read()
785
 
        self.addCleanup(broken_repo.unlock)
786
 
        stream = broken_repo.get_data_stream_for_search(search)
787
 
        empty_repo.lock_write()
788
 
        self.addCleanup(empty_repo.unlock)
789
 
        empty_repo.start_write_group()
790
 
        try:
791
 
            self.assertRaises(
792
 
                errors.KnitCorrupt, empty_repo.insert_data_stream, stream)
793
 
        finally:
794
 
            empty_repo.abort_write_group()
 
677
        self.assertRaises(errors.RevisionNotPresent, empty_repo.fetch, broken_repo)
795
678
 
796
679
 
797
680
class TestKnitPackNoSubtrees(TestCaseWithTransport):
816
699
            "Bazaar pack repository format 1 (needs bzr 0.92)\n",
817
700
                             t.get('format').read())
818
701
 
819
 
    def assertHasKndx(self, t, knit_name):
820
 
        """Assert that knit_name exists on t."""
821
 
        self.assertEqualDiff('# bzr knit index 8\n',
822
 
                             t.get(knit_name + '.kndx').read())
823
 
 
824
702
    def assertHasNoKndx(self, t, knit_name):
825
703
        """Assert that knit_name has no index on t."""
826
704
        self.assertFalse(t.has(knit_name + '.kndx'))
946
824
        pack_names = [node[1][0] for node in index.iter_all_entries()]
947
825
        self.assertTrue(large_pack_name in pack_names)
948
826
 
 
827
    def test_fail_obsolete_deletion(self):
 
828
        # failing to delete obsolete packs is not fatal
 
829
        format = self.get_format()
 
830
        server = fakenfs.FakeNFSServer()
 
831
        server.setUp()
 
832
        self.addCleanup(server.tearDown)
 
833
        transport = get_transport(server.get_url())
 
834
        bzrdir = self.get_format().initialize_on_transport(transport)
 
835
        repo = bzrdir.create_repository()
 
836
        repo_transport = bzrdir.get_repository_transport(None)
 
837
        self.assertTrue(repo_transport.has('obsolete_packs'))
 
838
        # these files are in use by another client and typically can't be deleted
 
839
        repo_transport.put_bytes('obsolete_packs/.nfsblahblah', 'contents')
 
840
        repo._pack_collection._clear_obsolete_packs()
 
841
        self.assertTrue(repo_transport.has('obsolete_packs/.nfsblahblah'))
 
842
 
949
843
    def test_pack_after_two_commits_packs_everything(self):
950
844
        format = self.get_format()
951
845
        tree = self.make_branch_and_tree('.', format=format)
990
884
 
991
885
    def _add_text(self, repo, fileid):
992
886
        """Add a text to the repository within a write group."""
993
 
        vf =repo.weave_store.get_weave(fileid, repo.get_transaction())
994
 
        vf.add_lines('samplerev+' + fileid, [], [])
 
887
        repo.texts.add_lines((fileid, 'samplerev+'+fileid), [], [])
995
888
 
996
889
    def test_concurrent_writers_merge_new_packs(self):
997
890
        format = self.get_format()
1168
1061
            inv.root.revision = revision_id
1169
1062
            root_id = inv.root.file_id
1170
1063
            sha1 = repo.add_inventory(revision_id, inv, [])
1171
 
            vf = repo.weave_store.get_weave_or_empty(root_id,
1172
 
                repo.get_transaction())
1173
 
            vf.add_lines(revision_id, [], [])
 
1064
            repo.texts.add_lines((root_id, revision_id), [], [])
1174
1065
            rev = bzrlib.revision.Revision(timestamp=0,
1175
1066
                                           timezone=None,
1176
1067
                                           committer="Foo Bar <foo@example.com>",
1191
1082
        inv = missing_ghost.get_inventory('tip')
1192
1083
        self.assertRaises(errors.NoSuchRevision,
1193
1084
            missing_ghost.get_revision, 'ghost')
1194
 
        self.assertRaises(errors.RevisionNotPresent,
 
1085
        self.assertRaises(errors.NoSuchRevision,
1195
1086
            missing_ghost.get_inventory, 'ghost')
1196
1087
 
1197
1088
    def test_supports_external_lookups(self):
1215
1106
 
1216
1107
    def get_format(self):
1217
1108
        return bzrdir.format_registry.make_bzrdir(
1218
 
            'development')
 
1109
            'development0')
1219
1110
 
1220
1111
    def check_format(self, t):
1221
1112
        self.assertEqualDiff(
1227
1118
 
1228
1119
    def get_format(self):
1229
1120
        return bzrdir.format_registry.make_bzrdir(
1230
 
            'development-subtree')
 
1121
            'development0-subtree')
1231
1122
 
1232
1123
    def check_format(self, t):
1233
1124
        self.assertEqualDiff(
1236
1127
            t.get('format').read())
1237
1128
 
1238
1129
 
 
1130
class TestExternalDevelopment1(object):
 
1131
 
 
1132
    # mixin class for testing stack-supporting development formats
 
1133
 
 
1134
    def test_compatible_cross_formats(self):
 
1135
        # early versions of the packing code relied on pack internals to
 
1136
        # stack, but the current version should be able to stack on any
 
1137
        # format.
 
1138
        repo = self.make_repository('repo', format=self.get_format())
 
1139
        if repo.supports_rich_root():
 
1140
            # can only stack on repositories that have compatible internal
 
1141
            # metadata
 
1142
            matching_format_name = 'pack-0.92-subtree'
 
1143
            mismatching_format_name = 'pack-0.92'
 
1144
        else:
 
1145
            matching_format_name = 'pack-0.92'
 
1146
            mismatching_format_name = 'pack-0.92-subtree'
 
1147
        base = self.make_repository('base', format=matching_format_name)
 
1148
        repo.add_fallback_repository(base)
 
1149
        # you can't stack on something with incompatible data
 
1150
        bad_repo = self.make_repository('mismatch',
 
1151
            format=mismatching_format_name)
 
1152
        self.assertRaises(errors.IncompatibleRepositories,
 
1153
            repo.add_fallback_repository, bad_repo)
 
1154
 
 
1155
    def test_adding_pack_does_not_record_pack_names_from_other_repositories(self):
 
1156
        base = self.make_branch_and_tree('base', format=self.get_format())
 
1157
        base.commit('foo')
 
1158
        referencing = self.make_branch_and_tree('repo', format=self.get_format())
 
1159
        referencing.branch.repository.add_fallback_repository(base.branch.repository)
 
1160
        referencing.commit('bar')
 
1161
        new_instance = referencing.bzrdir.open_repository()
 
1162
        new_instance.lock_read()
 
1163
        self.addCleanup(new_instance.unlock)
 
1164
        new_instance._pack_collection.ensure_loaded()
 
1165
        self.assertEqual(1, len(new_instance._pack_collection.all_packs()))
 
1166
 
 
1167
    def test_autopack_only_considers_main_repo_packs(self):
 
1168
        base = self.make_branch_and_tree('base', format=self.get_format())
 
1169
        base.commit('foo')
 
1170
        tree = self.make_branch_and_tree('repo', format=self.get_format())
 
1171
        tree.branch.repository.add_fallback_repository(base.branch.repository)
 
1172
        trans = tree.branch.repository.bzrdir.get_repository_transport(None)
 
1173
        # This test could be a little cheaper by replacing the packs
 
1174
        # attribute on the repository to allow a different pack distribution
 
1175
        # and max packs policy - so we are checking the policy is honoured
 
1176
        # in the test. But for now 11 commits is not a big deal in a single
 
1177
        # test.
 
1178
        for x in range(9):
 
1179
            tree.commit('commit %s' % x)
 
1180
        # there should be 9 packs:
 
1181
        index = GraphIndex(trans, 'pack-names', None)
 
1182
        self.assertEqual(9, len(list(index.iter_all_entries())))
 
1183
        # committing one more should coalesce to 1 of 10.
 
1184
        tree.commit('commit triggering pack')
 
1185
        index = GraphIndex(trans, 'pack-names', None)
 
1186
        self.assertEqual(1, len(list(index.iter_all_entries())))
 
1187
        # packing should not damage data
 
1188
        tree = tree.bzrdir.open_workingtree()
 
1189
        check_result = tree.branch.repository.check(
 
1190
            [tree.branch.last_revision()])
 
1191
        # We should have 50 (10x5) files in the obsolete_packs directory.
 
1192
        obsolete_files = list(trans.list_dir('obsolete_packs'))
 
1193
        self.assertFalse('foo' in obsolete_files)
 
1194
        self.assertFalse('bar' in obsolete_files)
 
1195
        self.assertEqual(50, len(obsolete_files))
 
1196
        # XXX: Todo check packs obsoleted correctly - old packs and indices
 
1197
        # in the obsolete_packs directory.
 
1198
        large_pack_name = list(index.iter_all_entries())[0][1][0]
 
1199
        # finally, committing again should not touch the large pack.
 
1200
        tree.commit('commit not triggering pack')
 
1201
        index = GraphIndex(trans, 'pack-names', None)
 
1202
        self.assertEqual(2, len(list(index.iter_all_entries())))
 
1203
        pack_names = [node[1][0] for node in index.iter_all_entries()]
 
1204
        self.assertTrue(large_pack_name in pack_names)
 
1205
 
 
1206
 
 
1207
class TestDevelopment1(TestKnitPackNoSubtrees, TestExternalDevelopment1):
 
1208
 
 
1209
    def get_format(self):
 
1210
        return bzrdir.format_registry.make_bzrdir(
 
1211
            'development')
 
1212
 
 
1213
    def check_format(self, t):
 
1214
        self.assertEqualDiff(
 
1215
            "Bazaar development format 1 (needs bzr.dev from before 1.6)\n",
 
1216
            t.get('format').read())
 
1217
 
 
1218
    def test_supports_external_lookups(self):
 
1219
        repo = self.make_repository('.', format=self.get_format())
 
1220
        self.assertTrue(repo._format.supports_external_lookups)
 
1221
 
 
1222
 
 
1223
class TestDevelopment1Subtree(TestKnitPackNoSubtrees, TestExternalDevelopment1):
 
1224
 
 
1225
    def get_format(self):
 
1226
        return bzrdir.format_registry.make_bzrdir(
 
1227
            'development-subtree')
 
1228
 
 
1229
    def check_format(self, t):
 
1230
        self.assertEqualDiff(
 
1231
            "Bazaar development format 1 with subtree support "
 
1232
            "(needs bzr.dev from before 1.6)\n",
 
1233
            t.get('format').read())
 
1234
 
 
1235
    def test_supports_external_lookups(self):
 
1236
        repo = self.make_repository('.', format=self.get_format())
 
1237
        self.assertTrue(repo._format.supports_external_lookups)
 
1238
 
 
1239
 
1239
1240
class TestRepositoryPackCollection(TestCaseWithTransport):
1240
1241
 
1241
1242
    def get_format(self):
1398
1399
        name = packs.names()[0]
1399
1400
        pack_1 = packs.get_pack_by_name(name)
1400
1401
        # the pack should be correctly initialised
1401
 
        rev_index = GraphIndex(packs._index_transport, name + '.rix',
1402
 
            packs._names[name][0])
1403
 
        inv_index = GraphIndex(packs._index_transport, name + '.iix',
1404
 
            packs._names[name][1])
1405
 
        txt_index = GraphIndex(packs._index_transport, name + '.tix',
1406
 
            packs._names[name][2])
1407
 
        sig_index = GraphIndex(packs._index_transport, name + '.six',
1408
 
            packs._names[name][3])
 
1402
        sizes = packs._names[name]
 
1403
        rev_index = GraphIndex(packs._index_transport, name + '.rix', sizes[0])
 
1404
        inv_index = GraphIndex(packs._index_transport, name + '.iix', sizes[1])
 
1405
        txt_index = GraphIndex(packs._index_transport, name + '.tix', sizes[2])
 
1406
        sig_index = GraphIndex(packs._index_transport, name + '.six', sizes[3])
1409
1407
        self.assertEqual(pack_repo.ExistingPack(packs._pack_transport,
1410
1408
            name, rev_index, inv_index, txt_index, sig_index), pack_1)
1411
1409
        # and the same instance should be returned on successive calls.