30
30
UninitializableFormat,
34
from bzrlib.osutils import getcwd
35
from bzrlib.revision import NULL_REVISION
33
import bzrlib.repository as repository
36
34
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
37
35
from bzrlib.trace import mutter
38
36
import bzrlib.transactions as transactions
88
86
# create a standalone_branch , clone that and check all bits are
88
# these should all check that the formats on subthings like repository
89
# are the same as the source format.
90
90
# features that are not supported (like detached working trees for
91
91
# older formats, should catch the error and silently pass the test
92
92
# as they are honouring the format.
99
99
# have checkouts force creation of a new branch because thats the
100
100
# desired semantic.
103
102
def test_format_initialize_find_open(self):
104
103
# loopback test to check the current format initializes to itself.
105
104
if not self.bzrdir_format.is_supported():
127
126
self.assertRaises(NotBranchError,
128
127
self.bzrdir_format.open,
129
128
get_transport(self.get_readonly_url()))
130
def test_create_repository(self):
131
# a bzrdir can construct a repository for itself.
132
if not self.bzrdir_format.is_supported():
133
# unsupported formats are not loopback testable
134
# because the default open will not open them and
135
# they may not be initializable.
137
t = get_transport(self.get_url())
138
made_control = self.bzrdir_format.initialize(t.base)
139
made_repo = made_control.create_repository()
140
self.failUnless(isinstance(made_repo, repository.Repository))
141
self.assertEqual(made_control, made_repo.bzrdir)
143
def test_open_repository(self):
144
if not self.bzrdir_format.is_supported():
145
# unsupported formats are not loopback testable
146
# because the default open will not open them and
147
# they may not be initializable.
149
t = get_transport(self.get_url())
150
made_control = self.bzrdir_format.initialize(t.base)
151
made_repo = made_control.create_repository()
152
opened_repo = made_control.open_repository()
153
self.assertEqual(made_control, opened_repo.bzrdir)
154
self.failUnless(isinstance(opened_repo, made_repo.__class__))