changeset 5206:dc3571a37b56 stable

evolve: support ancestor of orphan split with unrelated changeset in between This is done by searching for roots and heads within the range delimited on both sides by the target revs instead of just within the target revs. Example: o 5 | o 4 | o 3 | | * 2 | | | x 1 |/ o 0 1 is obsoleted by 3 and 5. We are considering the case when 2 gets evolved. Before the change, both roots and heads were [3, 5]. The user was offered a choice between 3 and 5 as the destination. After the change, roots are [3] and heads are [5]. 5 is chosen as the destination.
author Manuel Jacob <me@manueljacob.de>
date Wed, 11 Mar 2020 16:04:06 +0100
parents 240efc3ab4dd
children a5876853ba15
files hgext3rd/evolve/utility.py tests/test-evolve-split.t
diffstat 2 files changed, 28 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/utility.py	Wed Mar 11 18:50:39 2020 +0100
+++ b/hgext3rd/evolve/utility.py	Wed Mar 11 16:04:06 2020 +0100
@@ -139,8 +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)', targetrevs)
-    heads = repo.revs(b'heads(%ld)', targetrevs)
+    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:
         cheader = (_(b"ancestor of '%s' split over multiple topological"
                      b" branches.\nchoose an evolve destination:") %
--- a/tests/test-evolve-split.t	Wed Mar 11 18:50:39 2020 +0100
+++ b/tests/test-evolve-split.t	Wed Mar 11 16:04:06 2020 +0100
@@ -59,3 +59,29 @@
   $ hg evolve --rev "0::"
   move:[2] add uu
   atop:[4] _pp
+
+Split the changeset such that there's an unrelated changeset in between
+  $ hg --config extensions.strip= strip 4 -q
+  $ mkcommit bb
+  $ printf "pp" > pp;
+  $ hg add pp
+  $ hg commit -m "_pp"
+  $ hg prune --successor "desc(_oo) + desc(_pp)" -r "desc('oo+pp')" --split
+  1 changesets pruned
+  1 new orphan changesets
+  $ hg log -G
+  @  5:e4541785761d@default(draft) _pp
+  |
+  o  4:155f65ab6abc@default(draft) add bb
+  |
+  o  3:a7fdfda64c08@default(draft) _oo
+  |
+  | *  2:f52200b086ca@default(draft) add uu
+  | |
+  | x  1:d55647aaa0c6@default(draft) oo+pp
+  |/
+  o  0:58663bb03074@default(draft) add aa
+  
+  $ hg evolve --rev "0::"
+  move:[2] add uu
+  atop:[5] _pp