~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_remove.py

  • Committer: Marius Kruger
  • Date: 2007-08-11 11:29:05 UTC
  • mto: (2778.1.1 rm.marius)
  • mto: This revision was merged to the branch mainline in revision 2782.
  • Revision ID: amanic@gmail.com-20070811112905-tmibrlb8h5ezu5am
Remove unknown ignored files wihtout needing --force'

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for interface conformance of 'WorkingTree.remove'"""
18
18
 
19
19
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
20
 
from bzrlib import errors, osutils
 
20
from bzrlib import errors, ignores, osutils
21
21
 
22
22
class TestRemove(TestCaseWithWorkingTree):
23
23
    """Tests WorkingTree.remove"""
162
162
        tree.remove([''], keep_files=False)
163
163
        tree.remove(['xyz', 'abc/def'], keep_files=False)
164
164
 
165
 
    def test_remove_nonempty_directory(self):
 
165
    def test_remove_unchanged_directory(self):
166
166
        """Unchanged directories should be deleted."""
167
167
        files = ['b/', 'b/c', 'b/sub_directory/', 'b/sub_directory/with_file']
168
168
        tree = self.getCommittedTree(files)
170
170
        self.assertNotInWorkingTree('b')
171
171
        self.failIfExists('b')
172
172
 
 
173
    def test_remove_unknown_ignored_files(self):
 
174
        """unknown ignored files should be deleted."""
 
175
        tree = self.getCommittedTree(['b/'])
 
176
        ignores.add_runtime_ignores(["*ignored*"])
 
177
 
 
178
        self.build_tree(['unknown_ignored_file'])
 
179
        self.assertTrue(tree.is_ignored('unknown_ignored_file') != None)
 
180
        tree.remove('unknown_ignored_file', keep_files=False)
 
181
        self.assertNotInWorkingTree('unknown_ignored_file')
 
182
        self.failIfExists('unknown_ignored_file')
 
183
 
 
184
        self.build_tree(['b/unknown_ignored_file', 'b/unknown_ignored_dir/'])
 
185
        self.assertTrue(tree.is_ignored('b/unknown_ignored_file') != None)
 
186
        self.assertTrue(tree.is_ignored('b/unknown_ignored_dir') != None)
 
187
        tree.remove('b', keep_files=False)
 
188
        self.assertNotInWorkingTree('b')
 
189
        self.failIfExists('b')
 
190
 
173
191
    def test_dont_remove_directory_with_unknowns(self):
174
192
        """Directories with unknowns should not be deleted."""
175
193
        directories = ['a/', 'b/', 'c/', 'c/c/']