# HG changeset patch # User Anton Shestakov # Date 1709754404 10800 # Node ID cf37748874f4dc1cc68659d1e29d4e81399fce03 # Parent 08a9113a15ee1ec38ebba7dcbbcf44bbdf15003f 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 diff -r 08a9113a15ee -r cf37748874f4 hgext3rd/topic/__init__.py --- 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""" diff -r 08a9113a15ee -r cf37748874f4 tests/test-namespaces.t --- a/tests/test-namespaces.t Wed Mar 13 15:54:01 2024 -0300 +++ b/tests/test-namespaces.t Wed Mar 06 16:46:44 2024 -0300 @@ -286,6 +286,29 @@ abort: topic namespace 'nonsense' does not exist [10] +Debug command related to the default/empty topic namespace + + $ hg debug-topic-namespace --clear + + $ echo none > none + $ hg ci -qAm 'tns=none' \ + > --config extensions.topic=! \ + > --config extensions.commitextras= \ + > --extra topic-namespace=none + + + $ echo default > default + $ hg ci -qAm 'tns=default' \ + > --config extensions.topic=! \ + > --config extensions.commitextras= \ + > --extra topic-namespace=default + + + $ hg debug-default-topic-namespace \ + > -T '{rev}:{node|short} {join(extras, " ")}\n' + 4:29a2d0acd473 branch=stable topic-namespace=none + 5:16d6061fce0c branch=stable topic-namespace=default + Parsing $ hg debugparsefqbn foo/bar//user26/feature -T '[{branch}] <{topic_namespace}> ({topic})\n'