~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_repository.py

  • Committer: Jelmer Vernooij
  • Date: 2012-04-02 01:44:26 UTC
  • mfrom: (6518 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6519.
  • Revision ID: jelmer@samba.org-20120402014426-0o5qtysohyl006b2
merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
    )
46
46
from bzrlib import (
47
47
    bzrdir,
 
48
    controldir,
48
49
    errors,
49
50
    inventory,
50
51
    osutils,
66
67
class TestDefaultFormat(TestCase):
67
68
 
68
69
    def test_get_set_default_format(self):
69
 
        old_default = bzrdir.format_registry.get('default')
 
70
        old_default = controldir.format_registry.get('default')
70
71
        private_default = old_default().repository_format.__class__
71
72
        old_format = repository.format_registry.get_default()
72
73
        self.assertTrue(isinstance(old_format, private_default))
74
75
            my_bzrdir = bzrdir.BzrDirMetaFormat1()
75
76
            my_bzrdir.repository_format = SampleRepositoryFormat()
76
77
            return my_bzrdir
77
 
        bzrdir.format_registry.remove('default')
78
 
        bzrdir.format_registry.register('sample', make_sample_bzrdir, '')
79
 
        bzrdir.format_registry.set_default('sample')
 
78
        controldir.format_registry.remove('default')
 
79
        controldir.format_registry.register('sample', make_sample_bzrdir, '')
 
80
        controldir.format_registry.set_default('sample')
80
81
        # creating a repository should now create an instrumented dir.
81
82
        try:
82
83
            # the default branch format is used by the meta dir format
85
86
            result = dir.create_repository()
86
87
            self.assertEqual(result, 'A bzr repository dir')
87
88
        finally:
88
 
            bzrdir.format_registry.remove('default')
89
 
            bzrdir.format_registry.remove('sample')
90
 
            bzrdir.format_registry.register('default', old_default, '')
 
89
            controldir.format_registry.remove('default')
 
90
            controldir.format_registry.remove('sample')
 
91
            controldir.format_registry.register('default', old_default, '')
91
92
        self.assertIsInstance(repository.format_registry.get_default(),
92
93
                              old_format.__class__)
93
94
 
236
237
    def test_attribute__fetch_order(self):
237
238
        """Knits need topological data insertion."""
238
239
        repo = self.make_repository('.',
239
 
                format=bzrdir.format_registry.get('knit')())
 
240
                format=controldir.format_registry.get('knit')())
240
241
        self.assertEqual('topological', repo._format._fetch_order)
241
242
 
242
243
    def test_attribute__fetch_uses_deltas(self):
243
244
        """Knits reuse deltas."""
244
245
        repo = self.make_repository('.',
245
 
                format=bzrdir.format_registry.get('knit')())
 
246
                format=controldir.format_registry.get('knit')())
246
247
        self.assertEqual(True, repo._format._fetch_uses_deltas)
247
248
 
248
249
    def test_disk_layout(self):
334
335
        is valid when the api is not being abused.
335
336
        """
336
337
        repo = self.make_repository('.',
337
 
                format=bzrdir.format_registry.get('knit')())
 
338
                format=controldir.format_registry.get('knit')())
338
339
        inv_xml = '<inventory format="5">\n</inventory>\n'
339
340
        inv = repo._deserialise_inventory('test-rev-id', inv_xml)
340
341
        self.assertEqual('test-rev-id', inv.root.revision)
342
343
    def test_deserialise_uses_global_revision_id(self):
343
344
        """If it is set, then we re-use the global revision id"""
344
345
        repo = self.make_repository('.',
345
 
                format=bzrdir.format_registry.get('knit')())
 
346
                format=controldir.format_registry.get('knit')())
346
347
        inv_xml = ('<inventory format="5" revision_id="other-rev-id">\n'
347
348
                   '</inventory>\n')
348
349
        # Arguably, the deserialise_inventory should detect a mismatch, and
355
356
 
356
357
    def test_supports_external_lookups(self):
357
358
        repo = self.make_repository('.',
358
 
                format=bzrdir.format_registry.get('knit')())
 
359
                format=controldir.format_registry.get('knit')())
359
360
        self.assertFalse(repo._format.supports_external_lookups)
360
361
 
361
362
 
994
995
class TestRepositoryPackCollection(TestCaseWithTransport):
995
996
 
996
997
    def get_format(self):
997
 
        return bzrdir.format_registry.make_bzrdir('pack-0.92')
 
998
        return controldir.format_registry.make_bzrdir('pack-0.92')
998
999
 
999
1000
    def get_packs(self):
1000
1001
        format = self.get_format()