changeset 5883:24bfb5c7bf7a stable

next: filter unstable targets by topic only when there's no --no-topic Otherwise --no-topic makes no difference in how hg next works with unstable targets. Now that aspchildren filtering code actually works, this patch makes hg next behave correctly when dealing with unstable changesets with a different topic.
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 22 Apr 2021 17:18:37 +0800
parents 1d8148795dc2
children 21a8f0336f26
files hgext3rd/evolve/__init__.py tests/test-check-sdist.t tests/test-topic-prev-next.t
diffstat 3 files changed, 55 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py	Wed Apr 21 20:05:56 2021 +0800
+++ b/hgext3rd/evolve/__init__.py	Thu Apr 22 17:18:37 2021 +0800
@@ -856,7 +856,7 @@
         # check if we need to evolve while updating to the next child revision
         needevolve = False
         aspchildren = evolvecmd._aspiringchildren(repo, [repo[b'.'].rev()])
-        if topic:
+        if topic and not opts['no_topic']:
             filtered.update(rev for rev in aspchildren
                             if repo[rev].topic() != topic)
             aspchildren = [rev for rev in aspchildren if rev not in filtered]
--- a/tests/test-check-sdist.t	Wed Apr 21 20:05:56 2021 +0800
+++ b/tests/test-check-sdist.t	Thu Apr 22 17:18:37 2021 +0800
@@ -35,7 +35,7 @@
 
   $ tar -tzf hg-evolve-*.tar.gz | sed 's|^hg-evolve-[^/]*/||' | sort > files
   $ wc -l files
-  348 files
+  349 files
   $ fgrep debian files
   tests/test-check-debian.t
   $ fgrep __init__.py files
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-topic-prev-next.t	Thu Apr 22 17:18:37 2021 +0800
@@ -0,0 +1,53 @@
+  $ . "$TESTDIR/testlib/topic_setup.sh"
+  $ . "$TESTDIR/testlib/common.sh"
+
+  $ cat << EOF >> $HGRCPATH
+  > [extensions]
+  > evolve =
+  > [ui]
+  > logtemplate = '{rev} [{topic}] {desc}\n'
+  > EOF
+
+Making sure plain hg next sticks to topic when target is unstable
+
+  $ hg init next-unstable-topic
+  $ cd next-unstable-topic
+
+  $ mkcommit ROOT
+  $ hg topics topic-a
+  marked working directory as topic: topic-a
+  $ mkcommit A
+  active topic 'topic-a' grew its first changeset
+  (see 'hg help topics' for more information)
+  $ hg topics topic-b
+  $ mkcommit B
+  active topic 'topic-b' grew its first changeset
+  (see 'hg help topics' for more information)
+  $ hg up 'topic("topic-a")'
+  switching to topic topic-a
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo foo > foo
+  $ hg ci -A --amend
+  adding foo
+  1 new orphan changesets
+  $ hg log -G
+  @  3 [topic-a] A
+  |
+  | *  2 [topic-b] B
+  | |
+  | x  1 [topic-a] A
+  |/
+  o  0 [] ROOT
+  
+
+  $ hg next
+  no children on topic "topic-a"
+  do you want --no-topic
+  [1]
+
+  $ hg next --no-topic
+  move:[2] B
+  atop:[3] A
+  working directory is now at 53f8332d648f
+
+  $ cd ..