evolve: make sure divergence resolution doesn't undo changes (issue6203)
Before this patch, in content-divergence resolution logic if resolution
parent is not the parent of any of the two divergent changesets then
it could undo some changes introduced by previous revs (while resolving
stack of content-divergent changesets) as demonstrated by the test added in
previous patch.
To solve this, what this patch doing is: if divergent cset has obsolete
parent with a successor then first resolve the "orphan" instability of
divergent cset by relocating, then perform the content-divergence resolution.
After this change in logic, I found that it's kind of more correct as
reflected by the changes in tests/test-evolve-content-divergent-corner-cases.t
where it prevented creating conflicts while merging.
Changes in tests/test-evolve-content-divergent-stack.t demonstrate the fixed
behaviour.
Next patches will be covering the `evolve --continue` case for the relocation
of "divergent" cset.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: Mercurial graph Pages: 1 -->
<svg width="427pt" height="332pt"
viewBox="0.00 0.00 427.00 332.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 328)">
<title>Mercurial graph</title>
<!-- 0 -->
<g id="node1" class="node">
<title>0</title>
<polygon fill="none" stroke="#000000" stroke-width="4" points="72,-324 0,-324 0,-288 72,-288 72,-324"/>
<text text-anchor="middle" x="36" y="-302.3" font-family="mono" font-size="14.00" fill="#000000">0:0dc9</text>
</g>
<!-- 1 -->
<g id="node2" class="node">
<title>1</title>
<polygon fill="none" stroke="#000000" stroke-width="2" points="216,-324 144,-324 144,-288 216,-288 216,-324"/>
<text text-anchor="middle" x="180" y="-302.3" font-family="mono" font-size="14.00" fill="#000000">1:f649</text>
</g>
<!-- 0->1 -->
<g id="edge1" class="edge">
<title>0->1</title>
<path fill="none" stroke="#000000" stroke-width="2" d="M72.3373,-306C90.9973,-306 113.9327,-306 133.8329,-306"/>
<polygon fill="#000000" stroke="#000000" stroke-width="2" points="133.9241,-309.5001 143.924,-306 133.924,-302.5001 133.9241,-309.5001"/>
</g>
<!-- 2 -->
<g id="node3" class="node">
<title>2</title>
<polygon fill="none" stroke="#000000" stroke-width="2" points="216,-180 144,-180 144,-144 216,-144 216,-180"/>
<text text-anchor="middle" x="180" y="-158.3" font-family="mono" font-size="14.00" fill="#000000">2:96d8</text>
</g>
<!-- 0->2 -->
<g id="edge2" class="edge">
<title>0->2</title>
<path fill="none" stroke="#000000" stroke-width="2" d="M54.2377,-287.7623C79.6646,-262.3354 125.8747,-216.1253 154.6431,-187.3569"/>
<polygon fill="#000000" stroke="#000000" stroke-width="2" points="157.3142,-189.6356 161.9104,-180.0896 152.3644,-184.6858 157.3142,-189.6356"/>
</g>
<!-- 3 -->
<g id="node4" class="node">
<title>3</title>
<polygon fill="none" stroke="#000000" stroke-width="2" points="216,-36 144,-36 144,0 216,0 216,-36"/>
<text text-anchor="middle" x="180" y="-14.3" font-family="mono" font-size="14.00" fill="#000000">3:522d</text>
</g>
<!-- 0->3 -->
<g id="edge3" class="edge">
<title>0->3</title>
<path fill="none" stroke="#000000" stroke-width="2" d="M45.0078,-287.9843C69.5046,-238.9909 137.4407,-103.1186 166.5153,-44.9694"/>
<polygon fill="#000000" stroke="#000000" stroke-width="2" points="169.6539,-46.5184 170.9956,-36.0089 163.3929,-43.3879 169.6539,-46.5184"/>
</g>
<!-- 1->2 -->
<g id="edge4" class="edge">
<title>1->2</title>
<path fill="none" stroke="#000000" stroke-width="2" stroke-dasharray="5,2" d="M180,-279.7351C180,-250.8541 180,-205.2198 180,-180.0896"/>
<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="180" cy="-283.7623" rx="4" ry="4"/>
</g>
<!-- 2->3 -->
<g id="edge5" class="edge">
<title>2->3</title>
<path fill="none" stroke="#000000" stroke-width="2" stroke-dasharray="5,2" d="M180,-135.7351C180,-106.8541 180,-61.2198 180,-36.0896"/>
<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="180" cy="-139.7623" rx="4" ry="4"/>
</g>
<!-- T12 -->
<g id="node5" class="node">
<title>T12</title>
<text text-anchor="start" x="237" y="-231.3" font-family="mono" font-style="italic" font-size="14.00" fill="#000000">obsolete (and hidden)</text>
</g>
<!-- T12->1 -->
<g id="edge6" class="edge">
<title>T12->1</title>
<path fill="none" stroke="#c0c0c0" stroke-width="2" d="M287.6627,-252.1686C268.6604,-261.6698 245.2242,-273.3879 225.0748,-283.4626"/>
<polygon fill="#c0c0c0" stroke="#c0c0c0" stroke-width="2" points="223.455,-280.3593 216.076,-287.962 226.5855,-286.6203 223.455,-280.3593"/>
</g>
<!-- T12->2 -->
<g id="edge7" class="edge">
<title>T12->2</title>
<path fill="none" stroke="#c0c0c0" stroke-width="2" d="M287.6627,-215.8314C268.6604,-206.3302 245.2242,-194.6121 225.0748,-184.5374"/>
<polygon fill="#c0c0c0" stroke="#c0c0c0" stroke-width="2" points="226.5855,-181.3797 216.076,-180.038 223.455,-187.6407 226.5855,-181.3797"/>
</g>
</g>
</svg>