changeset 6615:9e442e116621

topic: use InputError instead of simple Abort for topic namespaces checks
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 16 Dec 2023 14:22:16 -0300
parents e0596b012b69
children 9107d91de94e
files hgext3rd/topic/__init__.py tests/test-namespaces.t
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Sat Dec 16 13:23:38 2023 -0300
+++ b/hgext3rd/topic/__init__.py	Sat Dec 16 14:22:16 2023 -0300
@@ -1833,7 +1833,7 @@
     """set or show the current topic namespace"""
     if opts.get('clear'):
         if tns:
-            raise error.Abort(_(b"cannot use --clear when setting a topic namespace"))
+            raise compat.InputError(_(b"cannot use --clear when setting a topic namespace"))
         tns = b'none'
     elif not tns:
         ui.write(b'%s\n' % repo.currenttns)
@@ -1841,9 +1841,9 @@
     if tns:
         tns = tns.strip()
         if not tns:
-            raise error.Abort(_(b"topic namespace cannot consist entirely of whitespace"))
+            raise compat.InputError(_(b"topic namespace cannot consist entirely of whitespace"))
         if b'/' in tns:
-            raise error.Abort(_(b"topic namespace cannot contain '/' character"))
+            raise compat.InputError(_(b"topic namespace cannot contain '/' character"))
         scmutil.checknewlabel(repo, tns, b'topic namespace')
 
         helptxt = _(b"topic namespace names can only consist of alphanumeric, "
--- a/tests/test-namespaces.t	Sat Dec 16 13:23:38 2023 -0300
+++ b/tests/test-namespaces.t	Sat Dec 16 14:22:16 2023 -0300
@@ -64,7 +64,7 @@
 
   $ hg debugtopicnamespace --clear nonsense
   abort: cannot use --clear when setting a topic namespace
-  [255]
+  [10]
 
   $ hg branch stable
   marked working directory as branch stable