~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_repository.py

  • Committer: Andrew Bennetts
  • Date: 2008-03-27 06:10:18 UTC
  • mfrom: (3309 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3320.
  • Revision ID: andrew.bennetts@canonical.com-20080327061018-dxztpxyv6yoeg3am
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
                           UnknownFormatError,
33
33
                           UnsupportedFormatError,
34
34
                           )
 
35
from bzrlib import graph
35
36
from bzrlib.index import GraphIndex, InMemoryGraphIndex
36
37
from bzrlib.repository import RepositoryFormat
37
38
from bzrlib.smart import server
175
176
        self.assertRaises(errors.OutSideTransaction,
176
177
            inv.add_lines, 'foo', [], [])
177
178
 
 
179
    def test_supports_external_lookups(self):
 
180
        control = bzrdir.BzrDirFormat6().initialize(self.get_url())
 
181
        repo = weaverepo.RepositoryFormat6().initialize(control)
 
182
        self.assertFalse(repo._format.supports_external_lookups)
 
183
 
178
184
 
179
185
class TestFormat7(TestCaseWithTransport):
180
186
    
288
294
        self.assertRaises(errors.OutSideTransaction,
289
295
            inv.add_lines, 'foo', [], [])
290
296
 
 
297
    def test_supports_external_lookups(self):
 
298
        control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
 
299
        repo = weaverepo.RepositoryFormat7().initialize(control)
 
300
        self.assertFalse(repo._format.supports_external_lookups)
 
301
 
291
302
 
292
303
class TestFormatKnit1(TestCaseWithTransport):
293
304
    
403
414
        inv = repo.deserialise_inventory('other-rev-id', inv_xml)
404
415
        self.assertEqual('other-rev-id', inv.root.revision)
405
416
 
 
417
    def test_supports_external_lookups(self):
 
418
        repo = self.make_repository('.',
 
419
                format=bzrdir.format_registry.get('knit')())
 
420
        self.assertFalse(repo._format.supports_external_lookups)
 
421
 
406
422
 
407
423
class KnitRepositoryStreamTests(test_knit.KnitTests):
408
424
    """Tests for knitrepo._get_stream_as_bytes."""
676
692
        self.assertRaises(errors.OutSideTransaction,
677
693
            inv.add_lines, 'foo', [], [])
678
694
 
 
695
    def test_supports_external_lookups(self):
 
696
        format = bzrdir.BzrDirMetaFormat1()
 
697
        format.repository_format = knitrepo.RepositoryFormatKnit3()
 
698
        repo = self.make_repository('.', format=format)
 
699
        self.assertFalse(repo._format.supports_external_lookups)
 
700
 
679
701
 
680
702
class TestWithBrokenRepo(TestCaseWithTransport):
681
703
    """These tests seem to be more appropriate as interface tests?"""
757
779
        """
758
780
        broken_repo = self.make_broken_repository()
759
781
        empty_repo = self.make_repository('empty-repo')
760
 
        stream = broken_repo.get_data_stream(['rev1a', 'rev2', 'rev3'])
 
782
        search = graph.SearchResult(set(['rev1a', 'rev2', 'rev3']),
 
783
            set(), 3, ['rev1a', 'rev2', 'rev3'])
 
784
        stream = broken_repo.get_data_stream_for_search(search)
761
785
        empty_repo.lock_write()
762
786
        self.addCleanup(empty_repo.unlock)
763
787
        empty_repo.start_write_group()
1168
1192
        self.assertRaises(errors.RevisionNotPresent,
1169
1193
            missing_ghost.get_inventory, 'ghost')
1170
1194
 
 
1195
    def test_supports_external_lookups(self):
 
1196
        repo = self.make_repository('.', format=self.get_format())
 
1197
        self.assertFalse(repo._format.supports_external_lookups)
 
1198
 
1171
1199
 
1172
1200
class TestKnitPackSubtrees(TestKnitPackNoSubtrees):
1173
1201
 
1181
1209
            t.get('format').read())
1182
1210
 
1183
1211
 
 
1212
class TestDevelopment0(TestKnitPackNoSubtrees):
 
1213
 
 
1214
    def get_format(self):
 
1215
        return bzrdir.format_registry.make_bzrdir(
 
1216
            'development')
 
1217
 
 
1218
    def check_format(self, t):
 
1219
        self.assertEqualDiff(
 
1220
            "Bazaar development format 0 (needs bzr.dev from before 1.3)\n",
 
1221
            t.get('format').read())
 
1222
 
 
1223
 
 
1224
class TestDevelopment0Subtree(TestKnitPackNoSubtrees):
 
1225
 
 
1226
    def get_format(self):
 
1227
        return bzrdir.format_registry.make_bzrdir(
 
1228
            'development-subtree')
 
1229
 
 
1230
    def check_format(self, t):
 
1231
        self.assertEqualDiff(
 
1232
            "Bazaar development format 0 with subtree support "
 
1233
            "(needs bzr.dev from before 1.3)\n",
 
1234
            t.get('format').read())
 
1235
 
 
1236
 
1184
1237
class TestRepositoryPackCollection(TestCaseWithTransport):
1185
1238
 
1186
1239
    def get_format(self):