diff hgext3rd/topic/__init__.py @ 6245:a54db3e55c88

topic: switch to namespace when updating to a commit, similar to topic
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 23 May 2022 14:02:54 +0400
parents 91d9a279b84a
children 213db29a19e9
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Thu May 26 14:16:58 2022 +0400
+++ b/hgext3rd/topic/__init__.py	Mon May 23 14:02:54 2022 +0400
@@ -1468,16 +1468,22 @@
         # if rebase is running and update the currenttopic to topic of new
         # rebased commit. We have explicitly stored in config if rebase is
         # running.
+        otns = repo.currenttns
         ot = repo.currenttopic
         if repo.ui.hasconfig(b'experimental', b'topicrebase'):
             isrebase = True
         if repo.ui.configbool(b'_internal', b'keep-topic'):
             ist0 = True
         if ((not partial and not branchmerge) or isrebase) and not ist0:
+            tns = b'default'
             t = b''
             pctx = repo[node]
             if pctx.phase() > phases.public:
+                tns = pctx.topic_namespace()
                 t = pctx.topic()
+            repo.vfs.write(b'topic-namespace', tns)
+            if tns != b'default' and tns != otns:
+                repo.ui.status(_(b"switching to topic-namespace %s\n") % tns)
             repo.vfs.write(b'topic', t)
             if t and t != ot:
                 repo.ui.status(_(b"switching to topic %s\n") % t)