changeset 6533:3d16c9a8cf3a

topic: update topic namespace revset to use "none" as the default/empty value Follow-up for 963471ebe26a.
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 17 Jul 2023 14:34:59 -0300
parents 9ed87a0d93c7
children 43a1bacf6a14
files hgext3rd/topic/revset.py tests/test-namespaces.t tests/test-topic.t
diffstat 3 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/revset.py	Thu Jul 06 14:49:54 2023 -0300
+++ b/hgext3rd/topic/revset.py	Mon Jul 17 14:34:59 2023 -0300
@@ -35,7 +35,7 @@
     mutable = revset._notpublic(repo, revset.fullreposet(repo), ())
 
     if not args:
-        return (subset & mutable).filter(lambda r: repo[r].topic_namespace() != b'default')
+        return (subset & mutable).filter(lambda r: repo[r].topic_namespace() != b'none')
 
     try:
         tns = getstringstrict(args[0], b'')
@@ -50,7 +50,7 @@
 
         def matches(r):
             tns = repo[r].topic_namespace()
-            if tns == b'default':
+            if tns == b'none':
                 return False
             return matcher(tns)
 
@@ -58,11 +58,11 @@
 
     s = revset.getset(repo, revset.fullreposet(repo), x)
     namespaces = {repo[r].topic_namespace() for r in s}
-    namespaces.discard(b'default')
+    namespaces.discard(b'none')
 
     def matches(r):
         tns = repo[r].topic_namespace()
-        if tns == b'default':
+        if tns == b'none':
             return False
         return tns in namespaces
 
--- a/tests/test-namespaces.t	Thu Jul 06 14:49:54 2023 -0300
+++ b/tests/test-namespaces.t	Mon Jul 17 14:34:59 2023 -0300
@@ -78,6 +78,8 @@
   >   hg log -T '{rev}: {topic_namespace}\n' -r "$1"
   > }
 
+  $ nslog 'topicnamespace()'
+  0: alice
   $ nslog 'topicnamespace(:)'
   0: alice
   $ nslog 'topicnamespace(all())'
--- a/tests/test-topic.t	Thu Jul 06 14:49:54 2023 -0300
+++ b/tests/test-topic.t	Mon Jul 17 14:34:59 2023 -0300
@@ -848,6 +848,10 @@
   abort: topic 'nonsense' does not exist
   [10]
 
+Sanity checks for topicnamespace() revset
+
+  $ tlog 'topicnamespace()'
+
 Deactivate the topic.
   $ hg topics
    * fran (1 changesets)