From patchwork Tue May 19 04:39:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Bug,6332] New: fold can create merge with ancestor From: mercurial-bugs@mercurial-scm.org X-Patchwork-Id: 46360 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Tue, 19 May 2020 04:39:17 +0000 https://bz.mercurial-scm.org/show_bug.cgi?id=6332 Bug ID: 6332 Summary: fold can create merge with ancestor Product: Mercurial Version: default branch Hardware: PC OS: Mac OS Status: UNCONFIRMED Severity: feature Priority: wish Component: evolution Assignee: bugzilla@mercurial-scm.org Reporter: martinvonz@google.com CC: mercurial-devel@mercurial-scm.org, pierre-yves.david@ens-lyon.org Python Version: --- If you fold the merge commit with all the commits on one side, you'll get a merge where one parent is an ancestor of the other. `hg merge` does not let you do that, so it should probably be considered a bug that `hg fold` allows it. The evolve tests did not detect the case because they used the null revision as merge base, so the merge commit ended up having a commit and the null revision as parents, which mercurial treats like a regular (non-merge) commit. If you apply this diff: ``` ``` Then the tests will fail with this hunk (among others): ``` @@ -362,9 +366,11 @@ 2 changesets folded 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg glf - @ 6: apple+banana+coconut is a child of zebra (apple banana coconut) - | - o 0: zebra (zebra) + @ 7: apple+banana+coconut is a child of zebra (apple banana coconut) + |\ + | o 1: zebra (zebra) + |/ + o 0: root (root) ``` diff --git a/tests/test-fold.t b/tests/test-fold.t --- a/tests/test-fold.t +++ b/tests/test-fold.t @@ -316,9 +316,10 @@ One merge commit $ hg init fold-a-merge $ cd fold-a-merge + $ mkcommit root $ mkcommit zebra - $ hg up null + $ hg up 'desc("root")' 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ mkcommit apple $ mkcommit banana