150
151
merge_inner(tree_b.branch, tree_a, tree_b.basis_tree(),
151
152
this_tree=tree_b, ignore_zero=True)
152
log = self._get_log(keep_log_file=True)
153
self.failUnless('All changes applied successfully.\n' not in log)
153
self.failUnless('All changes applied successfully.\n' not in
155
156
merge_inner(tree_b.branch, tree_a, tree_b.basis_tree(),
156
157
this_tree=tree_b, ignore_zero=False)
157
log = self._get_log(keep_log_file=True)
158
self.failUnless('All changes applied successfully.\n' in log)
158
self.failUnless('All changes applied successfully.\n' in self.get_log())
160
160
def test_merge_inner_conflicts(self):
161
161
tree_a = self.make_branch_and_tree('a')
522
522
self.add_uncommitted_version(('root', 'C:'), [('root', 'A')], 'fabg')
523
523
return _PlanMerge('B:', 'C:', self.plan_merge_vf, ('root',))
525
def test_base_from_plan(self):
526
self.setup_plan_merge()
527
plan = self.plan_merge_vf.plan_merge('B', 'C')
528
pwm = versionedfile.PlanWeaveMerge(plan)
529
self.assertEqual(['a\n', 'b\n', 'c\n'], pwm.base_from_plan())
525
531
def test_unique_lines(self):
526
532
plan = self.setup_plan_merge()
527
533
self.assertEqual(plan._unique_lines(
825
831
('unchanged', 'f\n'),
826
832
('unchanged', 'g\n')],
834
plan = self.plan_merge_vf.plan_lca_merge('F', 'G')
835
# This is one of the main differences between plan_merge and
836
# plan_lca_merge. plan_lca_merge generates a conflict for 'x => z',
837
# because 'x' was not present in one of the bases. However, in this
838
# case it is spurious because 'x' does not exist in the global base A.
840
('unchanged', 'h\n'),
841
('unchanged', 'a\n'),
842
('conflicted-a', 'x\n'),
844
('unchanged', 'c\n'),
845
('unchanged', 'd\n'),
846
('unchanged', 'y\n'),
847
('unchanged', 'f\n'),
848
('unchanged', 'g\n')],
851
def test_criss_cross_flip_flop(self):
852
# This is specificly trying to trigger problems when using limited
853
# ancestry and weaves. The ancestry graph looks like:
854
# XX unused ancestor, should not show up in the weave
858
# B C B & C both introduce a new line
862
# D E B & C are both merged, so both are common ancestors
863
# In the process of merging, both sides order the new
866
self.add_rev('root', 'XX', [], 'qrs')
867
self.add_rev('root', 'A', ['XX'], 'abcdef')
868
self.add_rev('root', 'B', ['A'], 'abcdgef')
869
self.add_rev('root', 'C', ['A'], 'abcdhef')
870
self.add_rev('root', 'D', ['B', 'C'], 'abcdghef')
871
self.add_rev('root', 'E', ['C', 'B'], 'abcdhgef')
872
plan = list(self.plan_merge_vf.plan_merge('D', 'E'))
874
('unchanged', 'a\n'),
875
('unchanged', 'b\n'),
876
('unchanged', 'c\n'),
877
('unchanged', 'd\n'),
879
('unchanged', 'g\n'),
881
('unchanged', 'e\n'),
882
('unchanged', 'f\n'),
884
pwm = versionedfile.PlanWeaveMerge(plan)
885
self.assertEqualDiff('\n'.join('abcdghef') + '\n',
886
''.join(pwm.base_from_plan()))
887
# Reversing the order reverses the merge plan, and final order of 'hg'
889
plan = list(self.plan_merge_vf.plan_merge('E', 'D'))
891
('unchanged', 'a\n'),
892
('unchanged', 'b\n'),
893
('unchanged', 'c\n'),
894
('unchanged', 'd\n'),
896
('unchanged', 'h\n'),
898
('unchanged', 'e\n'),
899
('unchanged', 'f\n'),
901
pwm = versionedfile.PlanWeaveMerge(plan)
902
self.assertEqualDiff('\n'.join('abcdhgef') + '\n',
903
''.join(pwm.base_from_plan()))
904
# This is where lca differs, in that it (fairly correctly) determines
905
# that there is a conflict because both sides resolved the merge
907
plan = list(self.plan_merge_vf.plan_lca_merge('D', 'E'))
909
('unchanged', 'a\n'),
910
('unchanged', 'b\n'),
911
('unchanged', 'c\n'),
912
('unchanged', 'd\n'),
913
('conflicted-b', 'h\n'),
914
('unchanged', 'g\n'),
915
('conflicted-a', 'h\n'),
916
('unchanged', 'e\n'),
917
('unchanged', 'f\n'),
919
pwm = versionedfile.PlanWeaveMerge(plan)
920
self.assertEqualDiff('\n'.join('abcdgef') + '\n',
921
''.join(pwm.base_from_plan()))
922
# Reversing it changes what line is doubled, but still gives a
924
plan = list(self.plan_merge_vf.plan_lca_merge('E', 'D'))
926
('unchanged', 'a\n'),
927
('unchanged', 'b\n'),
928
('unchanged', 'c\n'),
929
('unchanged', 'd\n'),
930
('conflicted-b', 'g\n'),
931
('unchanged', 'h\n'),
932
('conflicted-a', 'g\n'),
933
('unchanged', 'e\n'),
934
('unchanged', 'f\n'),
936
pwm = versionedfile.PlanWeaveMerge(plan)
937
self.assertEqualDiff('\n'.join('abcdhef') + '\n',
938
''.join(pwm.base_from_plan()))
829
940
def assertRemoveExternalReferences(self, filtered_parent_map,
830
941
child_map, tails, parent_map):