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.
$ . $TESTDIR/testlib/pythonpath.sh
$ echo "[extensions]" >> $HGRCPATH
$ echo "evolve=" >> $HGRCPATH
This test file tests the case of content-divergence resolution of changesets
that have the null revision as the parent.
$ hg init issue6201
$ cd issue6201
$ touch test
$ hg add test
$ hg commit -m test
$ hg log -T '{node|short}\n'
be090ea66256
$ echo a >> test
$ hg amend -m div1
$ hg log -T '{node|short}\n'
79fa0eb22d65
$ hg up be090ea66256 --hidden --quiet
updated to hidden changeset be090ea66256
(hidden revision 'be090ea66256' was rewritten as: 79fa0eb22d65)
working directory parent is obsolete! (be090ea66256)
$ echo a >> test
$ echo b >> test
$ hg amend -m div2
2 new content-divergent changesets
$ hg log -T '{node|short}\n'
4b2524b7508e
79fa0eb22d65
$ hg evolve --content-divergent --config ui.merge=internal:other
merge:[1] div1
with: [2] div2
base: [0] test
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
working directory is now at 12772224141b
$ hg evolve --list