changeset 5909:3571685e2aa2 stable

next: remove duplicated targets when updating from an unstable changeset
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 02 May 2021 22:06:11 +0800
parents 355bd0f7354b
children 126b9be3482d
files CHANGELOG hgext3rd/evolve/__init__.py tests/test-topic-prev-next.t
diffstat 3 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Sun Apr 25 23:50:21 2021 +0800
+++ b/CHANGELOG	Sun May 02 22:06:11 2021 +0800
@@ -1,6 +1,11 @@
 Changelog
 =========
 
+10.3.2 - in progress
+--------------------
+
+  * next: remove duplicated targets when updating from an unstable changeset
+
 10.3.1 -- 2021-04-25
 --------------------
 
--- a/hgext3rd/evolve/__init__.py	Sun Apr 25 23:50:21 2021 +0800
+++ b/hgext3rd/evolve/__init__.py	Sun May 02 22:06:11 2021 +0800
@@ -861,6 +861,11 @@
                             if repo[rev].topic() != topic)
             aspchildren = [rev for rev in aspchildren if rev not in filtered]
 
+        # Let's make sure we don't have any duplicates between children and
+        # aspiring children
+        filtered.update(ctx.rev() for ctx in children)
+        aspchildren = [rev for rev in aspchildren if rev not in filtered]
+
         # To catch and prevent the case when `next` would get confused by split,
         # lets filter those aspiring children which can be stablized on one of
         # the aspiring children itself.
--- a/tests/test-topic-prev-next.t	Sun Apr 25 23:50:21 2021 +0800
+++ b/tests/test-topic-prev-next.t	Sun May 02 22:06:11 2021 +0800
@@ -133,8 +133,23 @@
   o  0 [] root
   
 
+Simply walking on unstable changesets should work as expected
+
+  $ hg up 'desc("B2")'
+  switching to topic B
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [s1] B1
+  $ hg next
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  [s2] B2
+
 B1 shouldn't be considered a target, orphan or not
 
+  $ hg up 'desc("A2")'
+  switching to topic A
+  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg next
   move:[s3] A3
   atop:[s2] A2