~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-12-02 14:58:47 UTC
  • mfrom: (5554.1.3 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20101202145847-fw822sd3nyhvrwmi
(vila) Merge 2.2 into trunk including fix for bug #583667 and bug
        #681885 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
from bzrlib.tests import (
22
22
    script,
23
 
    features,
 
23
    SymlinkFeature,
24
24
    TestCaseWithTransport,
25
25
    TestSkipped,
26
26
    )
53
53
        for f in files:
54
54
            id=f+_id
55
55
            self.assertNotInWorkingTree(f)
56
 
            self.assertPathDoesNotExist(f)
 
56
            self.failIfExists(f)
57
57
 
58
58
    def assertFilesUnversioned(self, files):
59
59
        for f in files:
60
60
            self.assertNotInWorkingTree(f)
61
 
            self.assertPathExists(f)
 
61
            self.failUnlessExists(f)
62
62
 
63
63
    def changeFile(self, file_name):
64
64
        f = file(file_name, 'ab')
80
80
        self.assertEqual('', err)
81
81
        self.assertEqual('', out)
82
82
        self.assertInWorkingTree('foo', tree=tree)
83
 
        self.assertPathExists('foo')
 
83
        self.failUnlessExists('foo')
84
84
 
85
85
    def test_remove_no_files_specified_missing_dir_and_contents(self):
86
86
        tree = self._make_tree_and_add(
94
94
            err)
95
95
        # non-missing paths not touched:
96
96
        self.assertInWorkingTree('foo', tree=tree)
97
 
        self.assertPathExists('foo')
 
97
        self.failUnlessExists('foo')
98
98
        self.assertInWorkingTree('dir', tree=tree)
99
 
        self.assertPathExists('dir')
 
99
        self.failUnlessExists('dir')
100
100
        # missing files unversioned
101
101
        self.assertNotInWorkingTree('dir/missing', tree=tree)
102
102
        self.assertNotInWorkingTree('dir/missing/child', tree=tree)
120
120
        self.assertEqual('removed bar\n', err)
121
121
        # non-missing files not touched:
122
122
        self.assertInWorkingTree('foo', tree=tree)
123
 
        self.assertPathExists('foo')
 
123
        self.failUnlessExists('foo')
124
124
        # missing files unversioned
125
125
        self.assertNotInWorkingTree('bar', tree=tree)
126
126
 
127
127
    def test_remove_no_files_specified_missing_link(self):
128
 
        self.requireFeature(features.SymlinkFeature)
 
128
        self.requireFeature(SymlinkFeature)
129
129
        tree = self._make_tree_and_add(['foo'])
130
130
        os.symlink('foo', 'linkname')
131
131
        tree.add(['linkname'])
135
135
        self.assertEqual('removed linkname\n', err)
136
136
        # non-missing files not touched:
137
137
        self.assertInWorkingTree('foo', tree=tree)
138
 
        self.assertPathExists('foo')
 
138
        self.failUnlessExists('foo')
139
139
        # missing files unversioned
140
140
        self.assertNotInWorkingTree('linkname', tree=tree)
141
141
 
196
196
        self.run_bzr_remove_changed_files(
197
197
            ['../a', 'c', '.', '../d'], working_dir='b')
198
198
        self.assertNotInWorkingTree(files)
199
 
        self.assertPathDoesNotExist(files)
 
199
        self.failIfExists(files)
200
200
 
201
201
    def test_remove_keep_unversioned_files(self):
202
202
        self.build_tree(files)
216
216
        ''')
217
217
        self.assertFilesDeleted(files)
218
218
 
 
219
    def test_remove_force_unversioned_files(self):
 
220
        self.build_tree(files)
 
221
        tree = self.make_branch_and_tree('.')
 
222
        script.ScriptRunner().run_script(self, '''
 
223
        $ bzr remove --force a b/ b/c d/
 
224
        2>(The --force option is deprecated, rather use --no-backup in future.)
 
225
        2>deleted d
 
226
        2>removed b/c (but kept a copy: b/c.~1~)
 
227
        2>deleted b
 
228
        2>deleted a
 
229
        ''')
 
230
        self.assertFilesDeleted(files)
 
231
 
219
232
    def test_remove_deleted_files(self):
220
233
        tree = self._make_tree_and_add(files)
221
234
        self.run_bzr("commit -m 'added files'")
224
237
        for f in my_files:
225
238
            osutils.delete_any(f)
226
239
        self.assertInWorkingTree(files)
227
 
        self.assertPathDoesNotExist(files)
 
240
        self.failIfExists(files)
228
241
        self.run_bzr('remove ' + ' '.join(files))
229
242
        self.assertNotInWorkingTree(a)
230
 
        self.assertPathDoesNotExist(files)
 
243
        self.failIfExists(files)
231
244
 
232
245
    def test_remove_non_existing_files(self):
233
246
        tree = self._make_tree_and_add([])