changeset 6118:5d1bfde39b95 stable

topic: also make histedit clear the current topic if needed
author Simon Sapin <simon.sapin@octobus.net>
date Fri, 07 Jan 2022 18:06:46 +0100
parents a27bdd116761
children b883fc38e07c
files hgext3rd/topic/__init__.py tests/test-issue6550.t
diffstat 2 files changed, 39 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Fri Jan 07 17:52:34 2022 +0100
+++ b/hgext3rd/topic/__init__.py	Fri Jan 07 18:06:46 2022 +0100
@@ -749,9 +749,7 @@
     topic = None
     if util.safehasattr(rulectx, 'topic'):
         topic = rulectx.topic()
-
-    if topic:
-        _changecurrenttopic(repo, topic)
+    _changecurrenttopic(repo, topic)
 
 
 # revset predicates are automatically registered at loading via this symbol
--- a/tests/test-issue6550.t	Fri Jan 07 17:52:34 2022 +0100
+++ b/tests/test-issue6550.t	Fri Jan 07 18:06:46 2022 +0100
@@ -47,3 +47,41 @@
   o  0:c051488dac25 [topic1] A
   
   $ cd ..
+
+Editing commits without a topic on top of a commit with a topic:
+
+  $ hg init repo2
+  $ cd repo2
+  $ hg topic topic1
+  marked working directory as topic: topic1
+  $ echo 1 > A
+  $ hg ci -Aqm A
+  $ hg topic --clear
+  $ echo 1 > B
+  $ hg ci -Aqm B
+  $ echo 1 > C
+  $ hg ci -Aqm C
+  $ hg glog
+  @  2:c47acbb860b3 [] C
+  |
+  o  1:e2e2ca96a6bb [] B
+  |
+  o  0:c051488dac25 [topic1] A
+  
+Swap the order of commits B and C
+
+  $ hg histedit s1 -q --commands - 2>&1 << EOF
+  > pick c47acbb860b3 C
+  > pick e2e2ca96a6bb B
+  > EOF
+
+B and C still don't have a topic
+
+  $ hg glog
+  @  4:ff3439fe6f3d [] B
+  |
+  o  3:bb6fab1a29c6 [] C
+  |
+  o  0:c051488dac25 [topic1] A
+  
+  $ cd ..