13
13
# You should have received a copy of the GNU General Public License
14
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
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
"""Black-box tests for bzr remove-tree."""
38
38
os.chdir('branch1')
39
39
self.run_bzr('remove-tree')
40
40
self.failIfExists('foo')
42
42
def test_remove_tree_original_branch_explicit(self):
43
43
self.run_bzr('remove-tree branch1')
44
44
self.failIfExists('branch1/foo')
46
def test_remove_tree_multiple_branch_explicit(self):
47
self.tree.bzrdir.sprout('branch2')
48
self.run_bzr('remove-tree branch1 branch2')
49
self.failIfExists('branch1/foo')
50
self.failIfExists('branch2/foo')
46
52
def test_remove_tree_sprouted_branch(self):
47
53
self.tree.bzrdir.sprout('branch2')
48
54
self.failUnlessExists('branch2/foo')
49
55
os.chdir('branch2')
50
56
self.run_bzr('remove-tree')
51
57
self.failIfExists('foo')
53
59
def test_remove_tree_sprouted_branch_explicit(self):
54
60
self.tree.bzrdir.sprout('branch2')
55
61
self.failUnlessExists('branch2/foo')
64
70
self.failIfExists('foo')
66
72
self.failUnlessExists('branch1/foo')
68
74
def test_remove_tree_checkout_explicit(self):
69
75
self.tree.branch.create_checkout('branch2', lightweight=False)
70
76
self.failUnlessExists('branch2/foo')
84
90
self.failUnlessExists('foo')
86
92
self.failUnlessExists('branch1/foo')
88
94
def test_remove_tree_lightweight_checkout_explicit(self):
89
95
self.tree.branch.create_checkout('branch2', lightweight=True)
90
96
self.failUnlessExists('branch2/foo')
122
128
self.run_bzr('remove-tree branch1 --force')
123
129
self.failIfExists('branch1/foo')
124
130
self.failUnlessExists('branch1/bar')
132
def test_remove_tree_pending_merges(self):
133
self.run_bzr(['branch', 'branch1', 'branch2'])
134
self.build_tree(['branch1/bar'])
136
self.tree.commit('2')
137
self.failUnlessExists('branch1/bar')
138
self.run_bzr(['merge', '../branch1'], working_dir='branch2')
139
self.failUnlessExists('branch2/bar')
140
self.run_bzr(['revert', '.'], working_dir='branch2')
141
self.failIfExists('branch2/bar')
142
output = self.run_bzr_error(["Working tree .* has uncommitted changes"],
143
'remove-tree branch2', retcode=3)
145
def test_remove_tree_pending_merges_force(self):
146
self.run_bzr(['branch', 'branch1', 'branch2'])
147
self.build_tree(['branch1/bar'])
149
self.tree.commit('2')
150
self.failUnlessExists('branch1/bar')
151
self.run_bzr(['merge', '../branch1'], working_dir='branch2')
152
self.failUnlessExists('branch2/bar')
153
self.run_bzr(['revert', '.'], working_dir='branch2')
154
self.failIfExists('branch2/bar')
155
self.run_bzr('remove-tree branch2 --force')
156
self.failIfExists('branch2/foo')
157
self.failIfExists('branch2/bar')