# HG changeset patch # User Anton Shestakov # Date 1709834210 10800 # Node ID c94690f59beab5fadf05efba95cc5df515a33bbe # Parent cf37748874f4dc1cc68659d1e29d4e81399fce03 topic: allow selecting a specific tns value in debug-default-topic-namespace diff -r cf37748874f4 -r c94690f59bea hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Wed Mar 06 16:46:44 2024 -0300 +++ b/hgext3rd/topic/__init__.py Thu Mar 07 14:56:50 2024 -0300 @@ -1904,11 +1904,21 @@ for tns in repo.topic_namespaces: ui.write(b'%s\n' % (tns,)) -@command(b'debug-default-topic-namespace', commands.formatteropts) +@command(b'debug-default-topic-namespace', [ + (b'', b'none', True, b'find changesets with topic-namespace=none'), + (b'', b'default', False, b'find changesets with topic-namespace=default'), + ] + 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)$")') + condition = [] + if opts[b'none']: + condition += [b'extra("topic-namespace", "none")'] + if opts[b'default']: + condition += [b'extra("topic-namespace", "default")'] + if not condition: + condition = [b'none()'] + revs = repo.revs(b'not public() and not obsolete() and (%lr)', condition) displayer = logcmdutil.changesetdisplayer(ui, repo, opts) logcmdutil.displayrevs(ui, repo, revs, displayer, None) diff -r cf37748874f4 -r c94690f59bea tests/test-namespaces.t --- a/tests/test-namespaces.t Wed Mar 06 16:46:44 2024 -0300 +++ b/tests/test-namespaces.t Thu Mar 07 14:56:50 2024 -0300 @@ -303,8 +303,22 @@ > --config extensions.commitextras= \ > --extra topic-namespace=default + $ hg debug-default-topic-namespace \ + > --debug \ + > | grep extra + extra: branch=stable + extra: topic-namespace=none $ hg debug-default-topic-namespace \ + > --no-none \ + > --default \ + > --debug \ + > | grep extra + extra: branch=stable + extra: topic-namespace=default + + $ hg debug-default-topic-namespace \ + > --default \ > -T '{rev}:{node|short} {join(extras, " ")}\n' 4:29a2d0acd473 branch=stable topic-namespace=none 5:16d6061fce0c branch=stable topic-namespace=default