/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: Aaron Bentley
  • Date: 2007-02-09 07:16:20 UTC
  • mfrom: (2272 +trunk)
  • mto: (2255.6.1 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: aaron.bentley@utoronto.ca-20070209071620-gp2n7vtjyb0f2x1e
Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
class TestDefaultFormat(TestCase):
49
49
 
50
50
    def test_get_set_default_format(self):
51
 
        old_format = RepositoryFormat.get_default_format()
52
 
        test_format = SampleRepositoryFormat()
53
 
        RepositoryFormat.register_format(test_format)
 
51
        old_default = bzrdir.format_registry.get('default')
 
52
        private_default = old_default().repository_format.__class__
 
53
        old_format = repository.RepositoryFormat.get_default_format()
 
54
        self.assertTrue(isinstance(old_format, private_default))
 
55
        def make_sample_bzrdir():
 
56
            my_bzrdir = bzrdir.BzrDirMetaFormat1()
 
57
            my_bzrdir.repository_format = SampleRepositoryFormat()
 
58
            return my_bzrdir
 
59
        bzrdir.format_registry.remove('default')
 
60
        bzrdir.format_registry.register('sample', make_sample_bzrdir, '')
 
61
        bzrdir.format_registry.set_default('sample')
 
62
        # creating a repository should now create an instrumented dir.
54
63
        try:
55
 
            self.applyDeprecated(symbol_versioning.zero_fourteen, 
56
 
                RepositoryFormat.set_default_format, 
57
 
                test_format)
58
 
            # creating a repository should now create an instrumented dir.
59
 
            try:
60
 
                # the default branch format is used by the meta dir format
61
 
                # which is not the default bzrdir format at this point
62
 
                dir = bzrdir.BzrDirMetaFormat1().initialize('memory:///')
63
 
                result = dir.create_repository()
64
 
                self.assertEqual(result, 'A bzr repository dir')
65
 
            finally:
66
 
                self.applyDeprecated(symbol_versioning.zero_fourteen,
67
 
                    RepositoryFormat.set_default_format, old_format)
 
64
            # the default branch format is used by the meta dir format
 
65
            # which is not the default bzrdir format at this point
 
66
            dir = bzrdir.BzrDirMetaFormat1().initialize('memory:///')
 
67
            result = dir.create_repository()
 
68
            self.assertEqual(result, 'A bzr repository dir')
68
69
        finally:
69
 
            RepositoryFormat.unregister_format(test_format)
70
 
        self.assertEqual(old_format, RepositoryFormat.get_default_format())
 
70
            bzrdir.format_registry.remove('default')
 
71
            bzrdir.format_registry.register('default', old_default, '')
 
72
        self.assertIsInstance(repository.RepositoryFormat.get_default_format(),
 
73
                              old_format.__class__)
71
74
 
72
75
 
73
76
class SampleRepositoryFormat(repository.RepositoryFormat):