Mercurial > evolve
changeset 6241:85abf58c3d8c
topic: namespace template keyword
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Wed, 04 May 2022 15:55:34 +0400 |
parents | 2686ecc90791 |
children | a433fe0cea21 |
files | hgext3rd/topic/__init__.py tests/test-namespaces.t |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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):
--- 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'