evolve: close transaction if conflict is detected in relocate (issue4966)
Before this patch, transaction is aborted, if conflict is detected at
merging while "hg evolve".
Since 8f2ff40fe9c9 (or 3.6) of Mercurial, aborting transaction
discards all dirstate changes inside transaction scope for
"transactional dirstate" (see below wiki page for detail about it).
https://mercurial.selenic.com/wiki/DirstateTransactionPlan
Therefore, just aborting transaction causes unchanged (and unexpected)
dirstate, even though subsequent commands require dirstate changes
while "hg evolve".
To keep dirstate changes while "hg evolve", this patch closes current
running transaction, if conflict is detected in relocate(), even
though exception is raised as usual.
Even though "save dirstate and restore it after aborting transaction"
like shelve._aborttransaction() of Mercurial can also solve this
issue, this patch chose closing transaction for similarity with
failure for conflict at "hg unshelve". In addition to it, closing
transaction can keep any previous (implicit) changes.
In newly added test, there is an additional ancestor revision, which
"will be evolved safely". It is used to examine whether failure for
conflict doesn't discard already relocated revision(s) while "hg
evolve".
It is fact for current implementation that "hg evolve" relocates each
revisions in separated transactions and already relocated ones are
never discarded, even if subsequent relocation fails. Though, this
examination is useful to detect unintentional regression in the
future.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="250"
height="190"
id="svg8392"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="figure-ug08.svg">
<defs
id="defs8394">
<marker
inkscape:stockid="Arrow2Mend"
orient="auto"
refY="0"
refX="0"
id="marker3230"
style="overflow:visible">
<path
id="path3232"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="scale(-0.6,-0.6)"
inkscape:connector-curvature="0" />
</marker>
<marker
inkscape:stockid="Arrow2Mend"
orient="auto"
refY="0"
refX="0"
id="Arrow2Mend-2"
style="overflow:visible">
<path
id="path5316-7"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="scale(-0.6,-0.6)"
inkscape:connector-curvature="0" />
</marker>
<marker
inkscape:stockid="Arrow2Mend"
orient="auto"
refY="0"
refX="0"
id="marker8414"
style="overflow:visible">
<path
id="path8416"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="scale(-0.6,-0.6)"
inkscape:connector-curvature="0" />
</marker>
<marker
inkscape:stockid="Arrow2Mend"
orient="auto"
refY="0"
refX="0"
id="Arrow2Mend-2-7"
style="overflow:visible">
<path
id="path5316-7-1"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="scale(-0.6,-0.6)"
inkscape:connector-curvature="0" />
</marker>
<marker
inkscape:stockid="Arrow2Mend"
orient="auto"
refY="0"
refX="0"
id="marker8695"
style="overflow:visible">
<path
id="path8697"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="scale(-0.6,-0.6)"
inkscape:connector-curvature="0" />
</marker>
<marker
inkscape:stockid="Arrow2Mend"
orient="auto"
refY="0"
refX="0"
id="marker8695-6"
style="overflow:visible">
<path
id="path8697-4"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="scale(-0.6,-0.6)"
inkscape:connector-curvature="0" />
</marker>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2"
inkscape:cx="95.232262"
inkscape:cy="117.91553"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="824"
inkscape:window-height="830"
inkscape:window-x="647"
inkscape:window-y="278"
inkscape:window-maximized="0"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata8397">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-769.99805)">
<g
id="g8678"
transform="translate(0,-6)">
<rect
y="793.80884"
x="0.4999997"
height="18.053268"
width="21.481806"
id="rect2987-4"
style="fill:none;stroke:#000000;stroke-width:0.9999994;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
<text
sodipodi:linespacing="125%"
id="text5217-8"
y="807.20361"
x="3.4977415"
style="font-size:11.99999332px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
xml:space="preserve"><tspan
id="tspan6156"
sodipodi:role="line"
x="3.4977415"
y="807.20361">18</tspan></text>
</g>
<g
id="g3118"
transform="translate(-60.000001,786.36218)">
<rect
y="1.4467307"
x="120.5"
height="18.05327"
width="21.481739"
id="rect2987-4-02"
style="fill:none;stroke:#000000;stroke-width:0.99999791;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
<text
transform="scale(0.9999979,1.0000021)"
sodipodi:linespacing="125%"
id="text5217-8-72"
y="14.841505"
x="123.54487"
style="font-size:11.9999752px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
xml:space="preserve"><tspan
id="tspan6156-9"
sodipodi:role="line"
x="123.54487"
y="14.841505">19</tspan></text>
</g>
<g
id="g3126"
transform="translate(-60.000192,786.36218)">
<rect
y="1.4467307"
x="180.5"
height="18.05327"
width="21.481739"
id="rect2987-4-026"
style="fill:none;stroke:#000000;stroke-width:0.99999791;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
<text
transform="scale(0.9999979,1.0000021)"
sodipodi:linespacing="125%"
id="text5217-8-3"
y="14.841505"
x="183.42488"
style="font-size:11.9999752px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
xml:space="preserve"><tspan
id="tspan6156-0"
sodipodi:role="line"
x="183.42488"
y="14.841505">20</tspan></text>
</g>
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend-2);display:inline"
d="m 21.981806,796.83549 38.518193,4e-5"
id="path3178"
inkscape:connector-type="polyline"
inkscape:connector-curvature="0"
inkscape:connection-end="#g3118"
inkscape:connection-end-point="d4"
inkscape:connection-start="#g8678"
inkscape:connection-start-point="d4" />
<path
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend-2);display:inline"
d="m 81.981738,796.83555 38.518072,0"
id="path3180"
inkscape:connector-type="polyline"
inkscape:connector-curvature="0"
inkscape:connection-start="#g3118"
inkscape:connection-start-point="d4"
inkscape:connection-end="#g3126"
inkscape:connection-end-point="d4" />
<text
xml:space="preserve"
style="font-size:9.99999905px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Italic"
x="192.95625"
y="783.27075"
id="text4799-8"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4801-4"
x="192.95625"
y="783.27075">working dir</tspan></text>
<text
xml:space="preserve"
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Monospace;-inkscape-font-specification:Monospace"
x="80.662636"
y="851.4538"
id="text5217-8-0"
sodipodi:linespacing="125%"
transform="scale(0.9999979,1.0000021)"><tspan
sodipodi:role="line"
id="tspan8594"
x="80.662636"
y="851.4538">hg prune 19</tspan></text>
<g
id="g6372"
transform="translate(31.315375,797.54535)">
<path
inkscape:connector-curvature="0"
id="path8598"
d="m 36.655932,74.035228 3.649333,6.320665 3.711171,-6.427764"
style="fill:none;stroke:#808080;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<g
transform="matrix(1,0,0,1.5998137,5.836184,-16.712267)"
id="g3821">
<path
style="fill:none;stroke:#808080;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 35.5,23.60911 35.5,59.5"
id="path8466-5"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#808080;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="M 33.5,23.60911 33.5,59.5"
id="path8466-4-7"
inkscape:connector-curvature="0" />
</g>
</g>
<g
transform="matrix(1.0000032,0,0,0.99999991,-8.2080488e-7,99.00007)"
id="g8678-6">
<rect
y="793.80884"
x="0.4999997"
height="18.053268"
width="21.481806"
id="rect2987-4-9"
style="fill:none;stroke:#000000;stroke-width:0.9999994;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
<text
sodipodi:linespacing="125%"
id="text5217-8-32"
y="807.20361"
x="3.4977415"
style="font-size:11.99999332px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
xml:space="preserve"><tspan
id="tspan6156-8"
sodipodi:role="line"
x="3.4977415"
y="807.20361">18</tspan></text>
</g>
<rect
style="fill:none;stroke:#000000;stroke-width:0.99999946;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:0.99999946, 3.99999785;stroke-dashoffset:0"
id="rect2987-4-02-6"
width="21.481808"
height="18.053268"
x="60.5"
y="892.8089" />
<text
xml:space="preserve"
style="font-size:11.99999428px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
x="63.544647"
y="906.20331"
id="text5217-8-72-1"
sodipodi:linespacing="125%"><tspan
y="906.20331"
x="63.544647"
sodipodi:role="line"
id="tspan6156-9-8">19</tspan></text>
<g
id="g3126-8"
transform="matrix(1.0000032,0,0,0.99999991,-60.000385,891.36218)">
<rect
y="1.4467307"
x="180.5"
height="18.05327"
width="21.481739"
id="rect2987-4-026-7"
style="fill:none;stroke:#000000;stroke-width:0.99999791;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
<text
transform="scale(0.9999979,1.0000021)"
sodipodi:linespacing="125%"
id="text5217-8-3-8"
y="14.841505"
x="183.42488"
style="font-size:11.9999752px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
xml:space="preserve"><tspan
id="tspan6156-0-9"
sodipodi:role="line"
x="183.42488"
y="14.841505">20</tspan></text>
</g>
<path
style="fill:none;stroke:#000000;stroke-width:1.00000155px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend-2);display:inline"
d="m 21.981875,901.83548 38.518126,5e-5"
id="path3178-9"
inkscape:connector-type="polyline"
inkscape:connector-curvature="0"
inkscape:connection-start="#g8678-6"
inkscape:connection-start-point="d4" />
<path
style="fill:none;stroke:#000000;stroke-width:1.00000155px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend-2);display:inline"
d="m 81.981808,901.83554 38.518382,0"
id="path3180-1"
inkscape:connector-type="polyline"
inkscape:connector-curvature="0"
inkscape:connection-end="#g3126-8"
inkscape:connection-end-point="d4" />
<text
xml:space="preserve"
style="font-size:10px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Italic"
x="33.872818"
y="941.35645"
id="text9295"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan9297"
x="33.872818"
y="941.35645">obsolete</tspan><tspan
sodipodi:role="line"
x="33.872818"
y="953.85645"
id="tspan9299">but visible</tspan></text>
<text
xml:space="preserve"
style="font-size:10px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Italic"
x="125.75282"
y="939.66284"
id="text9301"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan9303"
x="125.75282"
y="939.66284">unstable</tspan></text>
<text
xml:space="preserve"
style="font-size:9.99999905px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Italic"
x="192.95625"
y="920.7381"
id="text4799-8-4"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan4801-4-2"
x="192.95625"
y="920.7381">working dir</tspan></text>
<path
style="color:#000000;fill:none;stroke:#707070;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-end:url(#marker8695);visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 188.0904,779.78292 c -26.25288,3.51598 -8.22083,22.5684 -39.59798,18.38478"
id="path9349"
inkscape:connector-curvature="0" />
<path
style="color:#000000;fill:none;stroke:#707070;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-end:url(#marker8695);visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 189.55807,918.25683 c -26.25288,-3.51598 -8.22083,-22.5684 -39.59798,-18.38478"
id="path9349-7"
inkscape:connector-curvature="0" />
<path
style="color:#000000;fill:none;stroke:#707070;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-end:url(#marker8695-6);visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 57.275649,931.10377 c 1.651424,-10.44392 15.963695,-1.81375 16.970563,-15.9099"
id="path9569"
inkscape:connector-curvature="0" />
<path
style="color:#000000;fill:none;stroke:#707070;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-end:url(#marker8695-6);visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 147.43176,929.68956 c -3.24422,-11.34319 -17.24529,-1.56955 -19.09188,-14.49569"
id="path9957"
inkscape:connector-curvature="0" />
</g>
</svg>