changeset 6244:945d27da146c

topic: format fqbn correctly from only a branch if it contains //
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 26 May 2022 14:16:58 +0400
parents 91d9a279b84a
children a54db3e55c88
files hgext3rd/topic/common.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/common.py	Sat May 14 23:29:48 2022 +0400
+++ b/hgext3rd/topic/common.py	Thu May 26 14:16:58 2022 +0400
@@ -51,6 +51,8 @@
     '//namespace/topic'
     >>> formatfqbn(branch=b'branch')
     'branch'
+    >>> formatfqbn(branch=b'branch//')
+    'branch////'
     >>> formatfqbn(namespace=b'namespace')
     '//namespace/'
     >>> formatfqbn(branch=b'/topic')
@@ -61,11 +63,13 @@
     'branch//namespace/topic'
     >>> formatfqbn(branch=b'foo/bar', namespace=b'user26', topic=b'feature')
     'foo/bar//user26/feature'
+    >>> formatfqbn(branch=b'http://example.com/branch', namespace=b'namespace', topic=b'topic')
+    'http://example.com/branch//namespace/topic'
     """
     result = b''
     if branch:
         result += branch
-    if namespace or topic:
+    if namespace or topic or b'//' in branch:
         result += b'//'
     if namespace:
         result += namespace + b'/'