Hello. I know each merge algorithm has its strengths and weaknesses, but for this case I couldn't find an explanation so I'm passing it to you. If you could have a look and say if this is a merge3 fixable bug or just something we have to live with. Thanks.
Grab this branch:
https://code.launchpad.net/~mysql/mysql-server/mysql-next
let's say you have it in a directory named "mysql-next"
and create two identical directories by branching "mysql-next" at revid <email address hidden> , call the first one "merge3" and the other "weave".
do
cd merge3
bzr merge ../mysql-next -r 'revid:<email address hidden>
(20 conflicts)
cd ../weave
bzr merge ../mysql-next -r 'revid:<email address hidden> --weave
(0 conflicts)
and then do a diff (like with kdiff3) of "merge3" and "weave" and look at file mysql-test/lib/mtr_cases.pm. It's "weave" which has it correct (so does --lca) and "merge3" which is wrong by having such line:
my %found_suites;
(and the few lines further which reference found_suites are also wrong).
Let me explain.
That "%found_suites" line existed, then we found that it caused a bug, and it was removed by <email address hidden> ; that bugfix revision is present in the MERGE_SOURCE branch (alik) and not in TREE (kristofer), the buggy code is absent from alik and present in kristofer. The logic is that the merge imports the bugfix revision and so removes the buggy code from TREE. That's what weave does, but not merge3 (and as it's a silent automerge by merge3, the colleague didn't notice it and the bug came back to life again http://bugs.mysql.com/bug.php?id=42807).
I figured it could be a case of old LCA which didn't have the buggy code either, so we would have a 3-way merge with "ancestor and MERGE_SOURCE don't have the code, TREE has it, so it's new in TREE and TREE wins". But maybe I'm oversimplifying. I couldn't reproduce this with a simple testcase with small few-revision branches.
Anyway that worries me, because so far I thought that merge3 was *only* introducing excess conflicts in criss-cross, but it also seems to automerge wrongly. Some of my colleagues seem to use merge3 in criss-cross merges unless there are too many conflicts (then fall back to weave), but this now looks wrong, it looks like they should always use weave in criss-cross merge even if few conflicts?
I wonder, would there be a way to force a logic in "bzr merge":
"if the merge is criss-cross then refuse to merge with anything else than weave, or automatically fall back to weave"?
I'm pretty sure this is the same per-file graph issue, and that merge3 is selecting too old of a base for the merge.