447
447
self.assertIs(os.path.lexists(this.wt.abspath('h.BASE')), False)
448
448
self.assertIs(os.path.lexists(this.wt.abspath('h.THIS')), True)
449
449
self.assertIs(os.path.lexists(this.wt.abspath('h.OTHER')), True)
451
def test_filename_merge(self):
452
base = TransformGroup("BASE")
453
this = TransformGroup("THIS")
454
other = TransformGroup("OTHER")
455
base_a, this_a, other_a = [t.tt.new_directory('a', t.root, 'a')
456
for t in [base, this, other]]
457
base_b, this_b, other_b = [t.tt.new_directory('b', t.root, 'b')
458
for t in [base, this, other]]
459
base.tt.new_directory('c', base_a, 'c')
460
this.tt.new_directory('c1', this_a, 'c')
461
other.tt.new_directory('c', other_b, 'c')
463
base.tt.new_directory('d', base_a, 'd')
464
this.tt.new_directory('d1', this_b, 'd')
465
other.tt.new_directory('d', other_a, 'd')
467
base.tt.new_directory('e', base_a, 'e')
468
this.tt.new_directory('e', this_a, 'e')
469
other.tt.new_directory('e1', other_b, 'e')
471
base.tt.new_directory('f', base_a, 'f')
472
this.tt.new_directory('f1', this_b, 'f')
473
other.tt.new_directory('f1', other_b, 'f')
475
for tg in [this, base, other]:
477
Merge3Merger(this.wt, this.wt, base.wt, other.wt)
478
self.assertEqual(this.wt.id2path('c'), os.path.join('b/c1'))
479
self.assertEqual(this.wt.id2path('d'), os.path.join('b/d1'))
480
self.assertEqual(this.wt.id2path('e'), os.path.join('b/e1'))
481
self.assertEqual(this.wt.id2path('f'), os.path.join('b/f1'))
483
def test_filename_merge_conflicts(self):
484
base = TransformGroup("BASE")
485
this = TransformGroup("THIS")
486
other = TransformGroup("OTHER")
487
base_a, this_a, other_a = [t.tt.new_directory('a', t.root, 'a')
488
for t in [base, this, other]]
489
base_b, this_b, other_b = [t.tt.new_directory('b', t.root, 'b')
490
for t in [base, this, other]]
492
base.tt.new_file('g', base_a, 'g', 'g')
493
other.tt.new_file('g1', other_b, 'g1', 'g')
495
base.tt.new_file('h', base_a, 'h', 'h')
496
this.tt.new_file('h1', this_b, 'h1', 'h')
498
base.tt.new_file('i', base.root, 'i', 'i')
499
this.tt.new_directory('i1', this_a, 'i')
500
other.tt.new_symlink('i', this_b, 'i', 'i')
502
for tg in [this, base, other]:
504
Merge3Merger(this.wt, this.wt, base.wt, other.wt)
506
self.assertEqual(this.wt.id2path('g'), os.path.join('b/g1.OTHER'))
507
self.assertIs(os.path.lexists(this.wt.abspath('b/g1.BASE')), True)
508
self.assertIs(os.path.lexists(this.wt.abspath('b/g1.THIS')), False)
509
self.assertEqual(this.wt.id2path('h'), os.path.join('b/h1.THIS'))
510
self.assertIs(os.path.lexists(this.wt.abspath('b/h1.BASE')), True)
511
self.assertIs(os.path.lexists(this.wt.abspath('b/h1.OTHER')), False)
512
self.assertEqual(this.wt.id2path('i'), os.path.join('b/i1.OTHER'))