~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-03-02 20:45:08 UTC
  • mfrom: (5051.3.9 named-branches)
  • Revision ID: pqm@pqm.ubuntu.com-20100302204508-4j07g2h9wj49o494
(Jelmer) Add name argument to BzrDir.create_branch(),
        BzrDir.destroy_branch() and BzrDir.open_branch().

Show diffs side-by-side

added added

removed removed

Lines of Context:
247
247
        try:
248
248
            bzrdir.destroy_branch()
249
249
        except (errors.UnsupportedOperation, errors.TransportNotPossible):
250
 
            raise TestNotApplicable('Format does not support destroying tree')
 
250
            raise TestNotApplicable('Format does not support destroying branch')
251
251
        self.assertRaises(errors.NotBranchError, bzrdir.open_branch)
252
252
        bzrdir.create_branch()
253
253
        bzrdir.open_branch()
254
254
 
 
255
    def test_destroy_colocated_branch(self):
 
256
        branch = self.make_branch('branch')
 
257
        bzrdir = branch.bzrdir
 
258
        try:
 
259
            colo_branch = bzrdir.create_branch('colo')
 
260
        except errors.NoColocatedBranchSupport:
 
261
            raise TestNotApplicable('BzrDir does not do colocated branches')
 
262
        bzrdir.destroy_branch("colo")
 
263
        self.assertRaises(errors.NotBranchError, bzrdir.open_branch, 
 
264
                          "colo")
 
265
 
255
266
    def test_destroy_repository(self):
256
267
        repo = self.make_repository('repository')
257
268
        bzrdir = repo.bzrdir
1410
1421
        self.failUnless(isinstance(made_branch, bzrlib.branch.Branch))
1411
1422
        self.assertEqual(made_control, made_branch.bzrdir)
1412
1423
 
 
1424
    def test_create_colo_branch(self):
 
1425
        # a bzrdir can construct a branch and repository for itself.
 
1426
        if not self.bzrdir_format.is_supported():
 
1427
            # unsupported formats are not loopback testable
 
1428
            # because the default open will not open them and
 
1429
            # they may not be initializable.
 
1430
            raise TestNotApplicable('Control dir format not supported')
 
1431
        t = get_transport(self.get_url())
 
1432
        made_control = self.bzrdir_format.initialize(t.base)
 
1433
        made_repo = made_control.create_repository()
 
1434
        try:
 
1435
            made_branch = made_control.create_branch("colo")
 
1436
        except errors.NoColocatedBranchSupport:
 
1437
            raise TestNotApplicable('Colocated branches not supported')
 
1438
        self.failUnless(isinstance(made_branch, bzrlib.branch.Branch))
 
1439
        self.assertEqual(made_control, made_branch.bzrdir)
 
1440
 
1413
1441
    def test_open_branch(self):
1414
1442
        if not self.bzrdir_format.is_supported():
1415
1443
            # unsupported formats are not loopback testable