31
31
self.build_tree(['branch1/foo'])
32
32
self.tree.add('foo')
33
33
self.tree.commit('1')
34
self.failUnlessExists('branch1/foo')
34
self.assertPathExists('branch1/foo')
38
38
def test_remove_tree_original_branch(self):
39
39
os.chdir('branch1')
40
40
self.run_bzr('remove-tree')
41
self.failIfExists('foo')
41
self.assertPathDoesNotExist('foo')
43
43
def test_remove_tree_original_branch_explicit(self):
44
44
self.run_bzr('remove-tree branch1')
45
self.failIfExists('branch1/foo')
45
self.assertPathDoesNotExist('branch1/foo')
47
47
def test_remove_tree_multiple_branch_explicit(self):
48
48
self.tree.bzrdir.sprout('branch2')
49
49
self.run_bzr('remove-tree branch1 branch2')
50
self.failIfExists('branch1/foo')
51
self.failIfExists('branch2/foo')
50
self.assertPathDoesNotExist('branch1/foo')
51
self.assertPathDoesNotExist('branch2/foo')
53
53
def test_remove_tree_sprouted_branch(self):
54
54
self.tree.bzrdir.sprout('branch2')
55
self.failUnlessExists('branch2/foo')
55
self.assertPathExists('branch2/foo')
56
56
os.chdir('branch2')
57
57
self.run_bzr('remove-tree')
58
self.failIfExists('foo')
58
self.assertPathDoesNotExist('foo')
60
60
def test_remove_tree_sprouted_branch_explicit(self):
61
61
self.tree.bzrdir.sprout('branch2')
62
self.failUnlessExists('branch2/foo')
62
self.assertPathExists('branch2/foo')
63
63
self.run_bzr('remove-tree branch2')
64
self.failIfExists('branch2/foo')
64
self.assertPathDoesNotExist('branch2/foo')
66
66
def test_remove_tree_checkout(self):
67
67
self.tree.branch.create_checkout('branch2', lightweight=False)
68
self.failUnlessExists('branch2/foo')
68
self.assertPathExists('branch2/foo')
69
69
os.chdir('branch2')
70
70
self.run_bzr('remove-tree')
71
self.failIfExists('foo')
71
self.assertPathDoesNotExist('foo')
73
self.failUnlessExists('branch1/foo')
73
self.assertPathExists('branch1/foo')
75
75
def test_remove_tree_checkout_explicit(self):
76
76
self.tree.branch.create_checkout('branch2', lightweight=False)
77
self.failUnlessExists('branch2/foo')
77
self.assertPathExists('branch2/foo')
78
78
self.run_bzr('remove-tree branch2')
79
self.failIfExists('branch2/foo')
80
self.failUnlessExists('branch1/foo')
79
self.assertPathDoesNotExist('branch2/foo')
80
self.assertPathExists('branch1/foo')
84
84
def test_remove_tree_lightweight_checkout(self):
85
85
self.tree.branch.create_checkout('branch2', lightweight=True)
86
self.failUnlessExists('branch2/foo')
86
self.assertPathExists('branch2/foo')
87
87
os.chdir('branch2')
88
88
output = self.run_bzr_error(
89
89
["You cannot remove the working tree from a lightweight checkout"],
90
90
'remove-tree', retcode=3)
91
self.failUnlessExists('foo')
91
self.assertPathExists('foo')
93
self.failUnlessExists('branch1/foo')
93
self.assertPathExists('branch1/foo')
95
95
def test_remove_tree_lightweight_checkout_explicit(self):
96
96
self.tree.branch.create_checkout('branch2', lightweight=True)
97
self.failUnlessExists('branch2/foo')
97
self.assertPathExists('branch2/foo')
98
98
output = self.run_bzr_error(
99
99
["You cannot remove the working tree from a lightweight checkout"],
100
100
'remove-tree branch2', retcode=3)
101
self.failUnlessExists('branch2/foo')
102
self.failUnlessExists('branch1/foo')
101
self.assertPathExists('branch2/foo')
102
self.assertPathExists('branch1/foo')
104
104
def test_remove_tree_empty_dir(self):
105
105
os.mkdir('branch2')
127
127
self.build_tree(['branch1/bar'])
128
128
self.tree.add('bar')
129
129
self.run_bzr('remove-tree branch1 --force')
130
self.failIfExists('branch1/foo')
131
self.failUnlessExists('branch1/bar')
130
self.assertPathDoesNotExist('branch1/foo')
131
self.assertPathExists('branch1/bar')
133
133
def test_remove_tree_pending_merges(self):
134
134
self.run_bzr(['branch', 'branch1', 'branch2'])
135
135
self.build_tree(['branch1/bar'])
136
136
self.tree.add('bar')
137
137
self.tree.commit('2')
138
self.failUnlessExists('branch1/bar')
138
self.assertPathExists('branch1/bar')
139
139
self.run_bzr(['merge', '../branch1'], working_dir='branch2')
140
self.failUnlessExists('branch2/bar')
140
self.assertPathExists('branch2/bar')
141
141
self.run_bzr(['revert', '.'], working_dir='branch2')
142
self.failIfExists('branch2/bar')
142
self.assertPathDoesNotExist('branch2/bar')
143
143
output = self.run_bzr_error(["Working tree .* has uncommitted changes"],
144
144
'remove-tree branch2', retcode=3)
148
148
self.build_tree(['branch1/bar'])
149
149
self.tree.add('bar')
150
150
self.tree.commit('2')
151
self.failUnlessExists('branch1/bar')
151
self.assertPathExists('branch1/bar')
152
152
self.run_bzr(['merge', '../branch1'], working_dir='branch2')
153
self.failUnlessExists('branch2/bar')
153
self.assertPathExists('branch2/bar')
154
154
self.run_bzr(['revert', '.'], working_dir='branch2')
155
self.failIfExists('branch2/bar')
155
self.assertPathDoesNotExist('branch2/bar')
156
156
self.run_bzr('remove-tree branch2 --force')
157
self.failIfExists('branch2/foo')
158
self.failIfExists('branch2/bar')
157
self.assertPathDoesNotExist('branch2/foo')
158
self.assertPathDoesNotExist('branch2/bar')
160
160
def test_remove_tree_shelved_changes(self):
161
161
# https://bugs.launchpad.net/bzr/+bug/586639