--- a/hgext3rd/evolve/utility.py Wed Jan 15 15:28:44 2020 +0700
+++ b/hgext3rd/evolve/utility.py Sun Dec 08 02:17:11 2019 +0530
@@ -125,6 +125,34 @@
return repo[newer[0][0]].rev()
+def picksplitsuccessor(ui, repo, ctx, evolvecand):
+ """choose a successor of ctx from split targets
+
+ Choose highest one if all successors are in a topological branch. And if
+ they are split over multiple topological branches, we ask user to choose
+ an evolve destination.
+
+ Return (True, succ) unless split targets are split over multiple
+ topological branches and user didn't choose any evolve destination,
+ in which case return (False, '.')
+ """
+ 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)
+ if len(roots) > 1 or len(heads) > 1:
+ cheader = (_(b"ancestor '%s' split over multiple topological"
+ b" branches.\nchoose an evolve destination:") %
+ evolvecand)
+ selectedrev = revselectionprompt(ui, repo, list(heads), cheader)
+ if selectedrev is None:
+ return (False, '.')
+ succ = repo[selectedrev]
+ else:
+ succ = repo[heads.first()]
+ return (True, repo[succ].rev())
+
def _successorrevs(repo, ctx):
try:
return {_singlesuccessor(repo, ctx)}