# HG changeset patch # User Anton Shestakov # Date 1687275024 10800 # Node ID 81e89d943a4ef991b46a8d5098959b4eaabd08d1 # Parent 198b87917ba834db5dd84430ff787fc44f1a8150 topic: pretend changeset has no topic namespace if it doesn't have a topic We only need this in case commit extras have topic namespace and no topic. Which is now prevented from happening by an earlier patch. diff -r 198b87917ba8 -r 81e89d943a4e hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Wed Sep 06 16:03:01 2023 -0300 +++ b/hgext3rd/topic/__init__.py Tue Jun 20 12:30:24 2023 -0300 @@ -316,6 +316,9 @@ # topic loaded, but not enabled (eg: multiple repo in the same process) if cache is None: return b'none' + # topic namespace is meaningless when topic is not set + if not self.topic(force): + return b'none' if self.rev() is None: # don't cache volatile ctx instances that aren't stored on-disk yet return self.extra().get(b'topic-namespace', b'none') diff -r 198b87917ba8 -r 81e89d943a4e tests/test-namespaces.t --- a/tests/test-namespaces.t Wed Sep 06 16:03:01 2023 -0300 +++ b/tests/test-namespaces.t Tue Jun 20 12:30:24 2023 -0300 @@ -5,22 +5,39 @@ $ hg init repo $ cd repo +Setting a topic namespace alone doesn't affect wdir() + $ hg debug-topic-namespace space-name marked working directory as topic namespace: space-name $ hg debug-topic-namespaces space-name $ hg log -r 'wdir()' -T '{topic_namespace}\n' + none + + $ hg log -r 'wdir()' -T '{fqbn}\n' + default + +But after setting a topic the already-set namespace is visible on wdir() + + $ hg topic feature + marked working directory as topic: feature + $ hg topics + * feature (0 changesets) + + $ hg log -r 'wdir()' -T '{topic_namespace}\n' space-name $ hg log -r 'wdir()' -T '{fqbn}\n' - default//space-name/ + default//space-name/feature $ hg branches $ hg debug-topic-namespace --clear $ hg debug-topic-namespaces + $ hg topic --clear + clearing empty topic "feature" $ hg topics $ hg debugtopicnamespace --clear nonsense