--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-evolve-orphan-switched-ancestors.t Sat Mar 21 20:36:41 2020 +0100
@@ -0,0 +1,37 @@
+ $ . $TESTDIR/testlib/common.sh
+ $ cat >> $HGRCPATH <<EOF
+ > [extensions]
+ > evolve=
+ > [alias]
+ > glog = log -GT "{rev}:{node|short} {desc}\n"
+ > EOF
+
+Test that, even if the order of the ancestors has been switched, the orphan is
+rebased such that it has the sucessors of both original ancestors are the new
+ancestors.
+
+ $ hg init repo
+ $ cd repo
+ $ mkcommit a
+ $ mkcommit b
+ $ echo a1 > a; echo b1 > b; hg ci -m 'mod ab'
+ $ hg up null -q
+ $ hg pick 1
+ picking 1:d2ae7f538514 "b"
+ 1 new orphan changesets
+ $ hg pick 0
+ picking 0:cb9a9f314b8b "a"
+ $ hg next --dry-run
+ move:[2] mod ab
+ atop:[4] a
+ hg rebase -r cc6607605d1e -d f4a8092719b1
+ $ hg evolve
+ move:[2] mod ab
+ atop:[4] a
+ $ hg glog
+ o 5:866738c73814 mod ab
+ |
+ @ 4:f4a8092719b1 a
+ |
+ o 3:6563da9dcf87 b
+