evolve: support successors of ancestor of orphan with multiple roots stable
authorManuel Jacob <me@manueljacob.de>
Wed, 11 Mar 2020 16:05:53 +0100
branchstable
changeset 5207 a5876853ba15
parent 5206 dc3571a37b56
child 5208 e0885e2abf59
evolve: support successors of ancestor of orphan with multiple roots The previous code checked that the set of successors has a single root. However, there’s no reason to require that in general. Example: o 6 | o 5 |\ | o 4 | | o | 3 |/ | * 2 | | | x 1 |/ o 0 1 is obsoleted by 3, 4 and 6. We are considering the case when 2 gets evolved. The roots are [3, 4] and the heads are [6]. Before the change, the user was asked which destination to choose, but there was only one choice (6). After the change, 6 is chosen as the destination.
hgext3rd/evolve/utility.py
tests/test-evolve-split.t
--- a/hgext3rd/evolve/utility.py	Wed Mar 11 16:04:06 2020 +0100
+++ b/hgext3rd/evolve/utility.py	Wed Mar 11 16:05:53 2020 +0100
@@ -139,9 +139,8 @@
     targets = obsutil.successorssets(repo, ctx.node())[0]
     assert targets
     targetrevs = [repo[r].rev() for r in targets]
-    roots = repo.revs(b'roots(%ld::%ld)', targetrevs, targetrevs)
     heads = repo.revs(b'heads(%ld::%ld)', targetrevs, targetrevs)
-    if len(roots) > 1 or len(heads) > 1:
+    if len(heads) > 1:
         cheader = (_(b"ancestor of '%s' split over multiple topological"
                      b" branches.\nchoose an evolve destination:") %
                    evolvecand)
--- a/tests/test-evolve-split.t	Wed Mar 11 16:04:06 2020 +0100
+++ b/tests/test-evolve-split.t	Wed Mar 11 16:05:53 2020 +0100
@@ -85,3 +85,56 @@
   $ hg evolve --rev "0::"
   move:[2] add uu
   atop:[5] _pp
+
+  $ cd ..
+  $ hg init split-merged
+  $ cd split-merged
+  $ mkcommit aa
+
+Split the changeset such that the successors don't have a single root
+  $ printf "oo" > oo;
+  $ printf "pp" > pp;
+  $ printf "qq" > qq;
+  $ hg add oo pp qq
+  $ hg commit -m "oo+pp+qq"
+  $ mkcommit uu
+  $ hg up 0
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  $ printf "oo" > oo;
+  $ hg add oo
+  $ hg commit -m "_oo"
+  created new head
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ printf "pp" > pp;
+  $ hg add pp
+  $ hg commit -m "_pp"
+  created new head
+  $ hg merge 3
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'merge oo and pp'
+  $ printf "qq" > qq;
+  $ hg add qq
+  $ hg commit -m "_qq"
+  $ hg prune --successor "desc(_oo) + desc(_pp) + desc(_qq)" -r "desc('oo+pp+qq')" --split
+  1 changesets pruned
+  1 new orphan changesets
+  $ hg log -G
+  @  6:ea5b1e180c04@default(draft) _qq
+  |
+  o    5:bf7c32161b4b@default(draft) merge oo and pp
+  |\
+  | o  4:ece0aaa22eb7@default(draft) _pp
+  | |
+  o |  3:a7fdfda64c08@default(draft) _oo
+  |/
+  | *  2:cc56c47d84b3@default(draft) add uu
+  | |
+  | x  1:575a7380a87d@default(draft) oo+pp+qq
+  |/
+  o  0:58663bb03074@default(draft) add aa
+  
+  $ hg evolve --rev "0::"
+  move:[2] add uu
+  atop:[6] _qq