235
239
transform3.adjust_path('tip', root_id, tip_id)
236
240
transform3.apply()
242
def test_conflict_on_case_insensitive(self):
243
tree = self.make_branch_and_tree('tree')
244
# Don't try this at home, kids!
245
# Force the tree to report that it is case sensitive, for conflict
247
tree.case_sensitive = True
248
transform = TreeTransform(tree)
249
self.addCleanup(transform.finalize)
250
transform.new_file('file', transform.root, 'content')
251
transform.new_file('FiLe', transform.root, 'content')
252
result = transform.find_conflicts()
253
self.assertEqual([], result)
254
# Force the tree to report that it is case insensitive, for conflict
256
tree.case_sensitive = False
257
result = transform.find_conflicts()
258
self.assertEqual([('duplicate', 'new-1', 'new-2', 'file')], result)
260
def test_conflict_on_case_insensitive_existing(self):
261
tree = self.make_branch_and_tree('tree')
262
self.build_tree(['tree/FiLe'])
263
# Don't try this at home, kids!
264
# Force the tree to report that it is case sensitive, for conflict
266
tree.case_sensitive = True
267
transform = TreeTransform(tree)
268
self.addCleanup(transform.finalize)
269
transform.new_file('file', transform.root, 'content')
270
result = transform.find_conflicts()
271
self.assertEqual([], result)
272
# Force the tree to report that it is case insensitive, for conflict
274
tree.case_sensitive = False
275
result = transform.find_conflicts()
276
self.assertEqual([('duplicate', 'new-1', 'new-2', 'file')], result)
278
def test_resolve_case_insensitive_conflict(self):
279
tree = self.make_branch_and_tree('tree')
280
# Don't try this at home, kids!
281
# Force the tree to report that it is case insensitive, for conflict
283
tree.case_sensitive = False
284
transform = TreeTransform(tree)
285
self.addCleanup(transform.finalize)
286
transform.new_file('file', transform.root, 'content')
287
transform.new_file('FiLe', transform.root, 'content')
288
resolve_conflicts(transform)
290
self.failUnlessExists('tree/file')
291
self.failUnlessExists('tree/FiLe.moved')
293
def test_resolve_checkout_case_conflict(self):
294
tree = self.make_branch_and_tree('tree')
295
# Don't try this at home, kids!
296
# Force the tree to report that it is case insensitive, for conflict
298
tree.case_sensitive = False
299
transform = TreeTransform(tree)
300
self.addCleanup(transform.finalize)
301
transform.new_file('file', transform.root, 'content')
302
transform.new_file('FiLe', transform.root, 'content')
303
resolve_conflicts(transform,
304
pass_func=lambda t, c: resolve_checkout(t, c, []))
306
self.failUnlessExists('tree/file')
307
self.failUnlessExists('tree/FiLe.moved')
309
def test_apply_case_conflict(self):
310
"""Ensure that a transform with case conflicts can always be applied"""
311
tree = self.make_branch_and_tree('tree')
312
transform = TreeTransform(tree)
313
self.addCleanup(transform.finalize)
314
transform.new_file('file', transform.root, 'content')
315
transform.new_file('FiLe', transform.root, 'content')
316
dir = transform.new_directory('dir', transform.root)
317
transform.new_file('dirfile', dir, 'content')
318
transform.new_file('dirFiLe', dir, 'content')
319
resolve_conflicts(transform)
321
self.failUnlessExists('tree/file')
322
if not os.path.exists('tree/FiLe.moved'):
323
self.failUnlessExists('tree/FiLe')
324
self.failUnlessExists('tree/dir/dirfile')
325
if not os.path.exists('tree/dir/dirFiLe.moved'):
326
self.failUnlessExists('tree/dir/dirFiLe')
328
def test_case_insensitive_limbo(self):
329
tree = self.make_branch_and_tree('tree')
330
# Don't try this at home, kids!
331
# Force the tree to report that it is case insensitive
332
tree.case_sensitive = False
333
transform = TreeTransform(tree)
334
self.addCleanup(transform.finalize)
335
dir = transform.new_directory('dir', transform.root)
336
first = transform.new_file('file', dir, 'content')
337
second = transform.new_file('FiLe', dir, 'content')
338
self.assertContainsRe(transform._limbo_name(first), 'new-1/file')
339
self.assertNotContainsRe(transform._limbo_name(second), 'new-1/FiLe')
238
341
def test_add_del(self):
239
342
start, root = self.get_transform()
240
343
start.new_directory('a', root, 'a')