fold: allow folding merge commits in a way that avoids issue6332

We don't create a merge where one of the parent is an ancestor of the other
parent: in such case, we just take the last parent and turn the merge commit
into a regular commit (with one parent).

--HG--
branch : stable
7 jobs for topic/stable/fold-merges in 3 minutes and 57 seconds (queued for 1 second)
latest
Status Job ID Name Coverage
  Test
passed doc #88347

00:00:42

passed flake8 #88341

00:00:38

manual pytype #88342
allowed to fail manual
passed tests-py2-cext #88343

00:03:57

passed tests-py2-pure #88344

00:03:32

passed tests-py3-cext #88345

00:03:53

passed tests-py3-pure #88346

00:02:15