changeset 6313:2cfae49c6c34 stable

next: properly handle cases when user selects an aspiring child When there are ambiguous next changesets and only some of them need to be evolved, and user picks one of them, next used to simply update to it without evolving. Now we check if it's an aspiring child and evolve it before updating to it. In test-prev-next.t, this case was previously handled by a separate hg evolve --update call. Without this fix, hg next would simply update to the revision 5 ("added d", which is still unstable) without evolving it. Thanks to Sebastian Unger, who spotted this bug on Evolve Testers mailing list.
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 26 Oct 2022 19:44:03 +0400
parents b4f9b7e468ee
children 29fb13dcb56c
files hgext3rd/evolve/__init__.py tests/test-prev-next.t
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py	Tue Oct 04 16:52:23 2022 -0400
+++ b/hgext3rd/evolve/__init__.py	Wed Oct 26 19:44:03 2022 +0400
@@ -929,6 +929,8 @@
                 ui.warn(_(b"explicitly update to one of them\n"))
                 return 1
             else:
+                if selectedrev in aspchildren:
+                    return _nextevolve(ui, repo, selectedrev, opts)
                 return _updatetonext(ui, repo, repo[selectedrev], display, opts)
         else:
             if not opts['evolve'] or not aspchildren:
--- a/tests/test-prev-next.t	Tue Oct 04 16:52:23 2022 -0400
+++ b/tests/test-prev-next.t	Wed Oct 26 19:44:03 2022 +0400
@@ -259,7 +259,17 @@
   o  0:a154386e50d1 added a
   
 
-  $ hg evolve -r 5 --update
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [6] added b (3)
+  $ hg next --evolve <<EOF
+  > 2
+  > EOF
+  ambiguous next changeset, choose one to update:
+  1: [5ce67c2407b0] added c
+  2: [9df671ccd2c7] added d
+  q: quit the prompt
+  enter the index of the revision you want to select: 2
   move:[5] added d
   atop:[6] added b (3)
   working directory is now at 47ea25be8aea