1162
1162
transform.cancel_creation(parent)
1163
1163
transform.finalize()
1165
def test_case_insensitive_clash(self):
1166
self.requireFeature(CaseInsensitiveFilesystemFeature)
1165
def test_rollback_on_directory_clash(self):
1167
1166
def tt_helper():
1168
1167
wt = self.make_branch_and_tree('.')
1169
1168
tt = TreeTransform(wt) # TreeTransform obtains write lock
1171
tt.new_file('foo', tt.root, 'bar')
1172
tt.new_file('Foo', tt.root, 'spam')
1170
foo = tt.new_directory('foo', tt.root)
1171
tt.new_file('bar', foo, 'foobar')
1172
baz = tt.new_directory('baz', tt.root)
1173
tt.new_file('qux', baz, 'quux')
1174
# Ask for a rename 'foo' -> 'baz'
1175
tt.adjust_path('baz', tt.root, foo)
1173
1176
# Lie to tt that we've already resolved all conflicts.
1174
1177
tt.apply(no_conflicts=True)
1181
# The rename will fail because the target directory is not empty (but
1182
# raises FileExists anyway).
1178
1183
err = self.assertRaises(errors.FileExists, tt_helper)
1179
1184
self.assertContainsRe(str(err),
1180
"^File exists: .+/foo")
1185
"^File exists: .+/baz")
1182
1187
def test_two_directories_clash(self):
1183
1188
def tt_helper():
1187
1192
foo_1 = tt.new_directory('foo', tt.root)
1188
1193
tt.new_directory('bar', foo_1)
1194
# Adding the same directory with a different content
1189
1195
foo_2 = tt.new_directory('foo', tt.root)
1190
1196
tt.new_directory('baz', foo_2)
1191
1197
# Lie to tt that we've already resolved all conflicts.
1205
1211
foo_1 = tt.new_directory('foo', tt.root)
1206
1212
tt.new_directory('bar', foo_1)
1213
# Adding the same directory with a different content
1207
1214
foo_2 = tt.new_directory('foo', tt.root)
1208
1215
tt.new_directory('baz', foo_2)
1209
1216
# Lie to tt that we've already resolved all conflicts.