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