comparison hgext3rd/topic/__init__.py @ 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
comparison
equal deleted inserted replaced
6614:e0596b012b69 6615:9e442e116621
1831 _(b'[NAMESPACE|--clear]')) 1831 _(b'[NAMESPACE|--clear]'))
1832 def debugtopicnamespace(ui, repo, tns=None, **opts): 1832 def debugtopicnamespace(ui, repo, tns=None, **opts):
1833 """set or show the current topic namespace""" 1833 """set or show the current topic namespace"""
1834 if opts.get('clear'): 1834 if opts.get('clear'):
1835 if tns: 1835 if tns:
1836 raise error.Abort(_(b"cannot use --clear when setting a topic namespace")) 1836 raise compat.InputError(_(b"cannot use --clear when setting a topic namespace"))
1837 tns = b'none' 1837 tns = b'none'
1838 elif not tns: 1838 elif not tns:
1839 ui.write(b'%s\n' % repo.currenttns) 1839 ui.write(b'%s\n' % repo.currenttns)
1840 return 1840 return
1841 if tns: 1841 if tns:
1842 tns = tns.strip() 1842 tns = tns.strip()
1843 if not tns: 1843 if not tns:
1844 raise error.Abort(_(b"topic namespace cannot consist entirely of whitespace")) 1844 raise compat.InputError(_(b"topic namespace cannot consist entirely of whitespace"))
1845 if b'/' in tns: 1845 if b'/' in tns:
1846 raise error.Abort(_(b"topic namespace cannot contain '/' character")) 1846 raise compat.InputError(_(b"topic namespace cannot contain '/' character"))
1847 scmutil.checknewlabel(repo, tns, b'topic namespace') 1847 scmutil.checknewlabel(repo, tns, b'topic namespace')
1848 1848
1849 helptxt = _(b"topic namespace names can only consist of alphanumeric, " 1849 helptxt = _(b"topic namespace names can only consist of alphanumeric, "
1850 b"'-', '_' and '.' characters") 1850 b"'-', '_' and '.' characters")
1851 try: 1851 try: