63
63
self.assertEqual(TreeLink().kind_character(), '')
67
class TestRemove(TestCaseWithTransport):
68
"""Tests WorkingTree.remove"""
70
files=['a','b/','b/c']
75
self.makeAndChdirToTestDir()
76
tree = self.make_branch_and_tree('.')
77
self.build_tree(TestRemove.files)
80
def test_remove_unchanged_files(self):
81
"""check that unchanged files are removed and deleted."""
83
tree.add(TestRemove.files)
84
tree.commit("files must not have changes")
86
self.assertInWorkingTree(TestRemove.files)
88
tree.remove(TestRemove.files, keep_files=False)
90
self.assertNotInWorkingTree(TestRemove.files)
91
self.failIfExists(TestRemove.files)
93
def test_remove_changed_files(self):
94
"""check that changed files are removed but not deleted."""
96
tree.add(TestRemove.files)
97
self.assertInWorkingTree(TestRemove.files)
99
tree.remove(TestRemove.files, keep_files=False)
101
self.assertNotInWorkingTree(TestRemove.files)
102
self.failUnlessExists(TestRemove.files)
104
def test_force_remove_changed_files(self):
105
"""check that changed files are removed and deleted when forced."""
106
tree = self.getTree()
107
tree.add(TestRemove.files)
108
self.assertInWorkingTree(TestRemove.files)
110
tree.remove(TestRemove.files, keep_files=False, force=True)
112
self.assertNotInWorkingTree(TestRemove.files)
113
self.failIfExists(TestRemove.files)
115
def test_remove_nonexisting_files(self):
116
"""delete files which does not exist."""
117
tree = self.getTree()
118
tree.remove(TestRemove.files, keep_files=False)
119
tree.remove([''], keep_files=False)
120
tree.remove(TestRemove.b, keep_files=False)
122
def test_remove_nonempty_directory(self):
123
tree = self.getTree()
124
tree.add(TestRemove.files)
125
tree.commit("make sure b is versioned")
126
self.assertInWorkingTree(TestRemove.files)
127
self.failUnlessExists(TestRemove.files)
128
tree.remove(TestRemove.b, keep_files=False)
129
self.assertNotInWorkingTree(TestRemove.b)
130
self.failUnlessExists(TestRemove.b)
132
def test_force_remove_nonempty_directory(self):
133
tree = self.getTree()
134
tree.add(TestRemove.files)
135
tree.commit("make sure b is versioned")
136
self.assertInWorkingTree(TestRemove.files)
137
self.failUnlessExists(TestRemove.files)
138
tree.remove(TestRemove.b, keep_files=False, force=True)
139
self.assertNotInWorkingTree(TestRemove.b_c)
140
self.failIfExists(TestRemove.b_c)
142
def test_remove_keep(self):
143
"""check that files are unversioned but not delete."""
144
tree = self.getTree()
145
tree.add(TestRemove.files)
146
self.assertInWorkingTree(TestRemove.files)
148
tree.remove(TestRemove.files)
149
self.assertNotInWorkingTree(TestRemove.files)
150
self.failUnlessExists(TestRemove.files)
152
66
class TestDefaultFormat(TestCaseWithTransport):
154
68
def test_get_set_default_format(self):