bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
1551.6.25
by Aaron Bentley
 split out blackbox test for bzr remove  | 
1  | 
# Copyright (C) 2005, 2006 by Canonical Ltd
 | 
2  | 
#
 | 
|
3  | 
# This program is free software; you can redistribute it and/or modify
 | 
|
4  | 
# it under the terms of the GNU General Public License as published by
 | 
|
5  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
|
6  | 
# (at your option) any later version.
 | 
|
7  | 
#
 | 
|
8  | 
# This program is distributed in the hope that it will be useful,
 | 
|
9  | 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|
10  | 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|
11  | 
# GNU General Public License for more details.
 | 
|
12  | 
#
 | 
|
13  | 
# You should have received a copy of the GNU General Public License
 | 
|
14  | 
# along with this program; if not, write to the Free Software
 | 
|
15  | 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|
16  | 
||
17  | 
||
18  | 
import os  | 
|
19  | 
||
20  | 
from bzrlib.tests.blackbox import ExternalBase  | 
|
| 
1551.6.26
by Aaron Bentley
 Add support for remove --new  | 
21  | 
from bzrlib.workingtree import WorkingTree  | 
| 
1551.6.25
by Aaron Bentley
 split out blackbox test for bzr remove  | 
22  | 
|
23  | 
||
24  | 
class TestRemove(ExternalBase):  | 
|
25  | 
||
26  | 
def test_remove_deleted(self):  | 
|
27  | 
self.runbzr("init")  | 
|
28  | 
self.build_tree(['a'])  | 
|
29  | 
self.runbzr(['add', 'a'])  | 
|
30  | 
self.runbzr(['commit', '-m', 'added a'])  | 
|
31  | 
os.unlink('a')  | 
|
32  | 
self.runbzr(['remove', 'a'])  | 
|
| 
1551.6.26
by Aaron Bentley
 Add support for remove --new  | 
33  | 
|
34  | 
def test_remove_new(self):  | 
|
35  | 
self.build_tree(['filefile',  | 
|
36  | 
'dir/',  | 
|
37  | 
'dir/filefilefile'])  | 
|
38  | 
wt = self.make_branch_and_tree('.')  | 
|
39  | 
wt.add(['filefile', 'dir', 'dir/filefilefile'],  | 
|
40  | 
['filefile-id', 'dir-id', 'filefilefile-id'])  | 
|
41  | 
self.assertEqual(wt.path2id('filefile'), 'filefile-id')  | 
|
42  | 
self.assertEqual(wt.path2id('dir/filefilefile'), 'filefilefile-id')  | 
|
43  | 
self.assertEqual(wt.path2id('dir'), 'dir-id')  | 
|
44  | 
self.runbzr('remove --new')  | 
|
45  | 
wt = WorkingTree.open('.')  | 
|
46  | 
self.assertIs(wt.path2id('filefile'), None)  | 
|
47  | 
self.assertIs(wt.path2id('dir/filefilefile'), None)  | 
|
48  | 
self.assertIs(wt.path2id('dir'), None)  | 
|
49  | 
wt.add(['filefile', 'dir', 'dir/filefilefile'],  | 
|
50  | 
['filefile-id', 'dir-id', 'filefilefile-id'])  | 
|
51  | 
self.assertEqual(wt.path2id('filefile'), 'filefile-id')  | 
|
52  | 
self.assertEqual(wt.path2id('dir/filefilefile'), 'filefilefile-id')  | 
|
53  | 
self.assertEqual(wt.path2id('dir'), 'dir-id')  | 
|
54  | 
self.runbzr('remove --new dir')  | 
|
55  | 
wt = WorkingTree.open('.')  | 
|
56  | 
self.assertEqual(wt.path2id('filefile'), 'filefile-id')  | 
|
57  | 
self.assertIs(wt.path2id('dir/filefilefile'), None)  | 
|
58  | 
self.assertIs(wt.path2id('dir'), None)  | 
|
59  | 
self.runbzr('remove --new .')  | 
|
60  | 
wt = WorkingTree.open('.')  | 
|
61  | 
self.assertIs(wt.path2id('filefile'), None)  | 
|
62  | 
self.runbzr('remove --new .', retcode=3)  |