diff hgext3rd/topic/__init__.py @ 6738:cf37748874f4 stable

topic: add a simple debug command to list changesets with problematic tns The following topic namespaces are considered problematic: - "none", which currently represents an empty topic namespace and should never appear in commit extras - "default", which previously was representing an empty topic namespace and now might confuse some code
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 06 Mar 2024 16:46:44 -0300
parents 08a9113a15ee
children c94690f59bea
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Wed Mar 13 15:54:01 2024 -0300
+++ b/hgext3rd/topic/__init__.py	Wed Mar 06 16:46:44 2024 -0300
@@ -179,6 +179,7 @@
     hg,
     localrepo,
     lock as lockmod,
+    logcmdutil,
     merge,
     namespaces,
     node,
@@ -1903,6 +1904,14 @@
     for tns in repo.topic_namespaces:
         ui.write(b'%s\n' % (tns,))
 
+@command(b'debug-default-topic-namespace', commands.formatteropts)
+def debugdefaulttns(ui, repo, **opts):
+    """list changesets with the default topic namespace in commit extras"""
+    opts = pycompat.byteskwargs(opts)
+    revs = repo.revs(b'not public() and not obsolete() and extra("topic-namespace", "re:^(default|none)$")')
+    displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
+    logcmdutil.displayrevs(ui, repo, revs, displayer, None)
+
 @command(b'debug-parse-fqbn', commands.formatteropts, _(b'FQBN'), optionalrepo=True)
 def debugparsefqbn(ui, repo, fqbn, **opts):
     """parse branch//namespace/topic string into its components"""