~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: 2007-06-18 05:22:35 UTC
  • mfrom: (1551.15.27 Aaron's mergeable stuff)
  • Revision ID: pqm@pqm.ubuntu.com-20070618052235-mvns8j28szyzscy0
Turn list-weave into list-versionedfile

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
class TestRemove(ExternalBase):
33
33
 
 
34
    def run_bzr_captured(self, argv, retcode=0, encoding=None, stdin=None,
 
35
                         working_dir=None):
 
36
 
 
37
        # magically convert commands like 'remove abc' to ['remove', 'abc']
 
38
        if (isinstance(argv, tuple) and len(argv) == 1 and
 
39
            isinstance(argv[0], basestring)):
 
40
            argv = shlex.split(argv[0])
 
41
        return ExternalBase.run_bzr_captured(self, argv, retcode, encoding,
 
42
            stdin, working_dir)
 
43
 
34
44
    def _make_add_and_assert_tree(self, files):
35
45
        tree = self.make_branch_and_tree('.')
36
46
        self.build_tree(files)
64
74
            ' or --force to delete them regardless.'
65
75
            ])
66
76
        self.run_bzr_error(error_regexes,
67
 
            ['remove'] + list(files_to_remove))
 
77
            'remove ' + ' '.join(files_to_remove))
68
78
        #see if we can force it now
69
 
        self.run_bzr(['remove', '--force'] + list(files_to_remove))
 
79
        self.run_bzr('remove --force ' + ' '.join(files_to_remove))
70
80
 
71
81
    def test_remove_no_files_specified(self):
72
82
        tree = self._make_add_and_assert_tree([])
106
116
    def test_remove_invalid_files(self):
107
117
        self.build_tree(files)
108
118
        tree = self.make_branch_and_tree('.')
109
 
        self.run_bzr(['remove', '.', 'xyz', 'abc/def'])
 
119
        self.run_bzr_remove_changed_files(['unknown:[.\s]*xyz[.\s]*abc/def'],
 
120
            ['.', 'xyz', 'abc/def'])
110
121
 
111
122
    def test_remove_unversioned_files(self):
112
123
        self.build_tree(files)
142
153
    def test_remove_force_unversioned_files(self):
143
154
        self.build_tree(files)
144
155
        tree = self.make_branch_and_tree('.')
145
 
        self.run_bzr(['remove', '--force'] + list(files),
 
156
        self.run_bzr('remove --force ' + ' '.join(files),
146
157
                     error_regexes=["deleted a", "deleted b",
147
158
                                    "deleted b/c", "deleted d"])
148
159
        self.assertFilesDeleted(files)
162
173
 
163
174
    def test_remove_non_existing_files(self):
164
175
        tree = self._make_add_and_assert_tree([])
165
 
        self.run_bzr(['remove', 'b'])
 
176
        self.run_bzr_remove_changed_files(['unknown:[.\s]*b'], ['b'])
166
177
 
167
178
    def test_remove_keep_non_existing_files(self):
168
179
        tree = self._make_add_and_assert_tree([])