~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge destroy_tree from bzr.ab

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
        wt = dir.create_workingtree(revision_id=bzrlib.revision.NULL_REVISION)
152
152
        self.assertEqual([], wt.get_parent_ids())
153
153
 
 
154
    def test_destroy_workingtree(self):
 
155
        tree = self.make_branch_and_tree('tree')
 
156
        self.build_tree(['tree/file'])
 
157
        tree.add('file')
 
158
        tree.commit('first commit')
 
159
        bzrdir = tree.bzrdir
 
160
        try:
 
161
            bzrdir.destroy_workingtree(keep_files=False)
 
162
        except errors.UnsupportedOperation:
 
163
            raise TestSkipped('Format does not support destroying tree')
 
164
        self.failIfExists('tree/file')
 
165
        self.assertRaises(errors.NoWorkingTree, bzrdir.open_workingtree)
 
166
        bzrdir.create_workingtree()
 
167
        self.failUnlessExists('tree/file')
 
168
        bzrdir.destroy_workingtree(keep_files=True)
 
169
        self.failUnlessExists('tree/file')
 
170
        self.assertRaises(errors.NoWorkingTree, bzrdir.open_workingtree)
 
171
            
154
172
    def test_clone_bzrdir_empty(self):
155
173
        dir = self.make_bzrdir('source')
156
174
        target = dir.clone(self.get_url('target'))