~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        f.write("\nsome other new content!")
62
62
        f.close()
63
63
 
64
 
    def run_bzr_remove_changed_files(self, error_regexes, files_to_remove,
65
 
                                     working_dir=None):
66
 
        error_regexes.extend(["Can't safely remove modified or unknown files:",
67
 
            'Use --keep to not delete them,'
68
 
            ' or --force to delete them regardless.'
69
 
            ])
70
 
        self.run_bzr_error(error_regexes,
71
 
                           ['remove'] + list(files_to_remove),
72
 
                           working_dir=working_dir)
73
 
        #see if we can force it now
74
 
        self.run_bzr(['remove', '--force'] + list(files_to_remove),
75
 
                     working_dir=working_dir)
 
64
    def run_bzr_remove_changed_files(self, files_to_remove, working_dir=None):
 
65
        self.run_bzr(['remove'] + list(files_to_remove),
 
66
           working_dir=working_dir)
76
67
 
77
68
    def test_remove_new_no_files_specified(self):
78
69
        tree = self.make_branch_and_tree('.')
177
168
    def test_remove_unversioned_files(self):
178
169
        self.build_tree(files)
179
170
        tree = self.make_branch_and_tree('.')
180
 
        self.run_bzr_remove_changed_files(
181
 
            ['unknown:[.\s]*d/[.\s]*b/c[.\s]*b/[.\s]*a'], files)
 
171
        self.run_bzr_remove_changed_files(files)
182
172
 
183
173
    def test_remove_changed_files(self):
184
174
        tree = self._make_tree_and_add(files)
185
175
        self.run_bzr("commit -m 'added files'")
186
176
        self.changeFile(a)
187
177
        self.changeFile(c)
188
 
        self.run_bzr_remove_changed_files(['modified:[.\s]*a[.\s]*b/c'], files)
 
178
        self.run_bzr_remove_changed_files(files)
189
179
 
190
180
    def test_remove_changed_ignored_files(self):
191
181
        tree = self._make_tree_and_add(['a'])
192
182
        self.run_bzr(['ignore', 'a'])
193
 
        self.run_bzr_remove_changed_files(['added:[.\s]*a'], ['a'])
 
183
        self.run_bzr_remove_changed_files(['a'])
194
184
 
195
185
    def test_remove_changed_files_from_child_dir(self):
196
186
        if sys.platform == 'win32':
200
190
        self.changeFile(a)
201
191
        self.changeFile(c)
202
192
        self.run_bzr_remove_changed_files(
203
 
            ['modified:[.\s]*a[.\s]*b/c'],
204
193
            ['../a', 'c', '.', '../d'], working_dir='b')
205
194
        self.assertNotInWorkingTree(files)
206
195
        self.failIfExists(files)
216
205
        tree = self.make_branch_and_tree('.')
217
206
        self.run_bzr(['remove', '--force'] + list(files),
218
207
                     error_regexes=["deleted a", "deleted b",
219
 
                                    "deleted b/c", "deleted d"])
 
208
                                    "removed b/c", "deleted d"])
220
209
        self.assertFilesDeleted(files)
221
210
 
222
211
    def test_remove_deleted_files(self):