Mercurial > evolve
changeset 6319:8c664ed9c103
topic: use compat.InputError for invalid topic names
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Thu, 07 Apr 2022 20:28:11 +0300 |
parents | 3e488afe62f5 |
children | 0c780d972350 |
files | hgext3rd/topic/__init__.py tests/test-topic.t |
diffstat | 2 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Thu Apr 07 20:02:45 2022 +0300 +++ b/hgext3rd/topic/__init__.py Thu Apr 07 20:28:11 2022 +0300 @@ -902,7 +902,7 @@ if topic: topic = topic.strip() if not topic: - raise error.Abort(_(b"topic names cannot consist entirely of whitespace")) + raise compat.InputError(_(b"topic names cannot consist entirely of whitespace")) # Have some restrictions on the topic name just like bookmark name scmutil.checknewlabel(repo, topic, b'topic') @@ -916,7 +916,7 @@ utopic = '' rmatch = re.match(r'[-_.\w]+', utopic, re.UNICODE) if not utopic or not rmatch or rmatch.group(0) != utopic: - raise error.Abort(_(b"invalid topic name: '%s'") % topic, hint=helptxt) + raise compat.InputError(_(b"invalid topic name: '%s'") % topic, hint=helptxt) if list: ui.pager(b'topics')
--- a/tests/test-topic.t Thu Apr 07 20:02:45 2022 +0300 +++ b/tests/test-topic.t Thu Apr 07 20:28:11 2022 +0300 @@ -278,17 +278,17 @@ [10] $ hg topic ' ' abort: topic names cannot consist entirely of whitespace - [255] + [10] $ hg topic 'a12#45' abort: invalid topic name: 'a12#45' (topic names can only consist of alphanumeric, '-' '_' and '.' characters) - [255] + [10] $ hg topic 'foo bar' abort: invalid topic name: 'foo bar' (topic names can only consist of alphanumeric, '-' '_' and '.' characters) - [255] + [10] this is trying to list topic names $ hg topic '' @@ -296,7 +296,7 @@ $ hg topic '*12 B23' abort: invalid topic name: '*12 B23' (topic names can only consist of alphanumeric, '-' '_' and '.' characters) - [255] + [10] Test commit flag and help text @@ -328,12 +328,12 @@ $ hg --encoding utf-8 topic © abort: invalid topic name: '\xc2\xa9' (esc) (topic names can only consist of alphanumeric, '-' '_' and '.' characters) - [255] + [10] $ hg --encoding latin1 topic æ abort: invalid topic name: '\xc3\xa6' (esc) (topic names can only consist of alphanumeric, '-' '_' and '.' characters) - [255] + [10] Make a topic