diff hgext3rd/topic/__init__.py @ 6236:7ad8107d953a

topic: introduce topic namespaces concept starting with simple parsing
author Anton Shestakov <av6@dwimlabs.net>
date Tue, 03 May 2022 21:35:28 +0400
parents 2ec9c87e8574
children 0b9042408809
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Thu May 12 20:02:40 2022 +0400
+++ b/hgext3rd/topic/__init__.py	Tue May 03 21:35:28 2022 +0400
@@ -1500,3 +1500,15 @@
     # Restore the topic if need
     if topic:
         _changecurrenttopic(repo, topic)
+
+@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"""
+    branch, tns, topic = common.parsefqbn(fqbn)
+    opts = pycompat.byteskwargs(opts)
+    fm = ui.formatter(b'debug-parse-namespace', opts)
+    fm.startitem()
+    fm.write(b'branch', b'branch:    %s\n', branch)
+    fm.write(b'topic_namespace', b'namespace: %s\n', tns)
+    fm.write(b'topic', b'topic:     %s\n', topic)
+    fm.end()