~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
                          ChrootedTestCase,
48
48
                          TestCase,
49
49
                          TestCaseWithTransport,
 
50
                          TestNotApplicable,
50
51
                          TestSkipped,
51
52
                          )
52
53
from bzrlib.tests.bzrdir_implementations import TestCaseWithBzrDir
167
168
        self.failUnlessExists('tree/file')
168
169
        self.assertRaises(errors.NoWorkingTree, bzrdir.open_workingtree)
169
170
 
 
171
    def test_destroy_branch(self):
 
172
        branch = self.make_branch('branch')
 
173
        bzrdir = branch.bzrdir
 
174
        try:
 
175
            bzrdir.destroy_branch()
 
176
        except (errors.UnsupportedOperation, errors.TransportNotPossible):
 
177
            raise TestNotApplicable('Format does not support destroying tree')
 
178
        self.assertRaises(errors.NotBranchError, bzrdir.open_branch)
 
179
        bzrdir.create_branch()
 
180
        bzrdir.open_branch()
 
181
 
170
182
    def test_open_workingtree_raises_no_working_tree(self):
171
183
        """BzrDir.open_workingtree() should raise NoWorkingTree (rather than
172
184
        e.g. NotLocalUrl) if there is no working tree.
445
457
                                     './.bzr/repository/inventory.knit',
446
458
                                     ])
447
459
 
448
 
        target.open_workingtree().revert([])
 
460
        target.open_workingtree().revert()
449
461
 
450
462
    def test_revert_inventory(self):
451
463
        tree = self.make_branch_and_tree('source')
464
476
                                     './.bzr/repository/inventory.knit',
465
477
                                     ])
466
478
 
467
 
        target.open_workingtree().revert([])
 
479
        target.open_workingtree().revert()
468
480
        self.assertDirectoriesEqual(dir.root_transport, target.root_transport,
469
481
                                    ['./.bzr/stat-cache',
470
482
                                     './.bzr/checkout/dirstate',
1358
1370
        self.failIf(transport.has('.bzr'))
1359
1371
        self.failUnless(transport.has('.bzr.retired.1'))
1360
1372
 
 
1373
    def test_retire_bzrdir_limited(self):
 
1374
        bd = self.make_bzrdir('.')
 
1375
        transport = bd.root_transport
 
1376
        # must not overwrite existing directories
 
1377
        self.build_tree(['.bzr.retired.0/', '.bzr.retired.0/junk',],
 
1378
            transport=transport)
 
1379
        self.failUnless(transport.has('.bzr'))
 
1380
        self.assertRaises((errors.FileExists, errors.DirectoryNotEmpty),
 
1381
            bd.retire_bzrdir, limit=0) 
 
1382
 
 
1383
 
1361
1384
class TestBreakLock(TestCaseWithBzrDir):
1362
1385
 
1363
1386
    def setUp(self):