/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-07 03:09:58 UTC
  • mfrom: (2268 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2269.
  • Revision ID: aaron.bentley@utoronto.ca-20070207030958-fx6ykp7rg7zma6xu
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
                           UnknownFormatError,
35
35
                           UnsupportedFormatError,
36
36
                           )
37
 
import bzrlib.repository as repository
 
37
from bzrlib.repository import RepositoryFormat
38
38
from bzrlib.tests import TestCase, TestCaseWithTransport
39
39
from bzrlib.transport import get_transport
40
40
from bzrlib.transport.memory import MemoryServer
41
 
from bzrlib import upgrade, workingtree
 
41
from bzrlib import (
 
42
    repository,
 
43
    upgrade,
 
44
    workingtree,
 
45
    )
42
46
 
43
47
 
44
48
class TestDefaultFormat(TestCase):
45
49
 
46
50
    def test_get_set_default_format(self):
47
 
        private_default = repository._default_format.__class__
 
51
        old_default = bzrdir.format_registry.get('default')
 
52
        private_default = old_default().repository_format.__class__
48
53
        old_format = repository.RepositoryFormat.get_default_format()
49
54
        self.assertTrue(isinstance(old_format, private_default))
50
 
        self.applyDeprecated(symbol_versioning.zero_fourteen, 
51
 
            repository.RepositoryFormat.set_default_format, 
52
 
            SampleRepositoryFormat())
 
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')
53
62
        # creating a repository should now create an instrumented dir.
54
63
        try:
55
64
            # the default branch format is used by the meta dir format
58
67
            result = dir.create_repository()
59
68
            self.assertEqual(result, 'A bzr repository dir')
60
69
        finally:
61
 
            self.applyDeprecated(symbol_versioning.zero_fourteen, 
62
 
                repository.RepositoryFormat.set_default_format, old_format)
63
 
        self.assertEqual(old_format, repository.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__)
64
74
 
65
75
 
66
76
class SampleRepositoryFormat(repository.RepositoryFormat):