# HG changeset patch # User Simon Sapin # Date 1641575206 -3600 # Node ID 5d1bfde39b95a733c1ed80488f400e218846cdc0 # Parent a27bdd1167613be20699e3b392e0b3f23e61d244 topic: also make histedit clear the current topic if needed diff -r a27bdd116761 -r 5d1bfde39b95 hgext3rd/topic/__init__.py --- 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 diff -r a27bdd116761 -r 5d1bfde39b95 tests/test-issue6550.t --- 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 ..