# HG changeset patch # User Anton Shestakov # Date 1651665334 -14400 # Node ID 85abf58c3d8cb2b6d72d279b975888479e1d5a62 # Parent 2686ecc90791b1e6d644875c8357d8cc52264664 topic: namespace template keyword diff -r 2686ecc90791 -r 85abf58c3d8c hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Wed May 04 15:53:57 2022 +0400 +++ b/hgext3rd/topic/__init__.py Wed May 04 15:55:34 2022 +0400 @@ -749,6 +749,12 @@ ctx = context.resource(mapping, b'ctx') return ctx.topicidx() +@templatekeyword(b'topic_namespace', requires={b'ctx'}) +def topicnamespacekw(context, mapping): + """:topic_namespace: String. The topic namespace of the changeset""" + ctx = context.resource(mapping, b'ctx') + return ctx.topic_namespace() + def wrapinit(orig, self, repo, *args, **kwargs): orig(self, repo, *args, **kwargs) if not hastopicext(repo): diff -r 2686ecc90791 -r 85abf58c3d8c tests/test-namespaces.t --- a/tests/test-namespaces.t Wed May 04 15:53:57 2022 +0400 +++ b/tests/test-namespaces.t Wed May 04 15:55:34 2022 +0400 @@ -10,6 +10,9 @@ $ hg debug-topic-namespaces space-name + $ hg log -r 'wdir()' -T '{topic_namespace}\n' + space-name + $ hg branches $ hg debug-topic-namespace --clear @@ -33,6 +36,9 @@ $ hg debug-topic-namespaces alice + $ hg log -r . -T '{rev}: {branch} {topic_namespace} {topic}\n' + 0: stable alice feature + Parsing $ hg debugparsefqbn foo/bar//user26/feature -T '[{branch}] <{topic_namespace}> ({topic})\n'