Patchwork [Bug,6332] New: fold can create merge with ancestor

login
register
mail settings
Submitter mercurial-bugs@mercurial-scm.org
Date May 19, 2020, 4:39 a.m.
Message ID <bug-6332-285@https.bz.mercurial-scm.org/>
Download mbox | patch
Permalink /patch/46360/
State Not Applicable
Headers show

Comments

mercurial-bugs@mercurial-scm.org - May 19, 2020, 4:39 a.m.
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)
```

Patch

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