changeset 6243:91d9a279b84a

topic: fqbn template keyword
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 14 May 2022 23:29:48 +0400
parents a433fe0cea21
children 945d27da146c
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	Tue May 24 19:30:27 2022 +0400
+++ b/hgext3rd/topic/__init__.py	Sat May 14 23:29:48 2022 +0400
@@ -763,6 +763,12 @@
     ctx = context.resource(mapping, b'ctx')
     return ctx.topic_namespace()
 
+@templatekeyword(b'fqbn', requires={b'ctx'})
+def fqbnkw(context, mapping):
+    """:fqbn: String. The branch//namespace/topic of the changeset"""
+    ctx = context.resource(mapping, b'ctx')
+    return ctx.fqbn()
+
 def wrapinit(orig, self, repo, *args, **kwargs):
     orig(self, repo, *args, **kwargs)
     if not hastopicext(repo):
--- a/tests/test-namespaces.t	Tue May 24 19:30:27 2022 +0400
+++ b/tests/test-namespaces.t	Sat May 14 23:29:48 2022 +0400
@@ -13,6 +13,9 @@
   $ hg log -r 'wdir()' -T '{topic_namespace}\n'
   space-name
 
+  $ hg log -r 'wdir()' -T '{fqbn}\n'
+  default//space-name/
+
   $ hg branches
 
   $ hg debug-topic-namespace --clear
@@ -39,6 +42,9 @@
   $ hg log -r . -T '{rev}: {branch} {topic_namespace} {topic}\n'
   0: stable alice feature
 
+  $ hg log -r . -T '{rev}: {fqbn}\n'
+  0: stable//alice/feature
+
 Parsing
 
   $ hg debugparsefqbn foo/bar//user26/feature -T '[{branch}] <{topic_namespace}> ({topic})\n'