Created attachment 1740 [details] Sample repository with problematic tree. Merging during rebase does not favor base in the rebased set, causing rebase to redo previously resolved merges. Reproduce: See attached repository. The tree starts like http://imgur.com/ELNVaXd $ hg rebase -s9 -d2 --keep --tool internal:merge merging f1.txt warning: conflicts during merge. merging f1.txt incomplete! (edit conflicts, then use 'hg resolve --mark') unresolved conflicts (see hg resolve, then hg rebase --continue) Expected Results: HG should resolve merge between (rebased 9) and 7 automatically. Encountered in Mercurial 2.7 (Linux). Also reproduced on Windows and OSX, and in Mercurial 2.5.4.
Able to confirm the bug with the provided test case. The first parent is used as the rebase base instead of the second parent (that was in the rebase set)
Fixed by http://selenic.com/repo/hg/rev/ad9db007656f Pierre-Yves David <pierre-yves.david@ens-lyon.org> rebase: fix selection of base used when rebasing merge (issue4041) Prior this changeset, rebasing a merge whose first parent was not in the rebase lead to wrong and highly conflicting merge. See the in-line comment for details. Test have been updated with the data provided by the reported. (please test the fix)