~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/bzrdir_implementations/test_bzrdir.py

Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
35
35
from bzrlib.trace import mutter
36
36
import bzrlib.transactions as transactions
 
37
import bzrlib.transport as transport
37
38
from bzrlib.transport import get_transport
38
39
from bzrlib.upgrade import upgrade
39
40
import bzrlib.workingtree as workingtree
215
216
        self.assertEqual(made_control, opened_tree.bzrdir)
216
217
        self.failUnless(isinstance(opened_tree, made_tree.__class__))
217
218
 
 
219
    def test_get_branch_transport(self):
 
220
        dir = self.make_bzrdir('.')
 
221
        # without a format, get_branch_transport gives use a transport
 
222
        # which -may- point to an existing dir.
 
223
        self.assertTrue(isinstance(dir.get_branch_transport(None),
 
224
                                   transport.Transport))
 
225
        # with a given format, either the bzr dir supports identifiable
 
226
        # branches, or it supports anonymous  branch formats, but not both.
 
227
        anonymous_format = branch.BzrBranchFormat4()
 
228
        identifiable_format = branch.BzrBranchFormat5()
 
229
        try:
 
230
            found_transport = dir.get_branch_transport(anonymous_format)
 
231
            self.assertRaises(errors.IncompatibleFormat,
 
232
                              dir.get_branch_transport,
 
233
                              identifiable_format)
 
234
        except errors.IncompatibleFormat:
 
235
            found_transport = dir.get_branch_transport(identifiable_format)
 
236
        self.assertTrue(isinstance(found_transport, transport.Transport))
 
237
        # and the dir which has been initialized for us must be statable.
 
238
        found_transport.stat('.')