This instance will be upgraded to Heptapod 0.21.0rc3 on 2021-04-23 at 10:30 UTC+2 (a few minutes of down time)

Commit dc7f4029 authored by Martin von Zweigbergk's avatar Martin von Zweigbergk

errors: use InputError for errors about bad label names (tags etc)

Differential Revision: https://phab.mercurial-scm.org/D9327
parent 3175b0e0058b
......@@ -293,19 +293,21 @@ def checknewlabel(repo, lbl, kind):
# Do not use the "kind" parameter in ui output.
# It makes strings difficult to translate.
if lbl in [b'tip', b'.', b'null']:
raise error.Abort(_(b"the name '%s' is reserved") % lbl)
raise error.InputError(_(b"the name '%s' is reserved") % lbl)
for c in (b':', b'\0', b'\n', b'\r'):
if c in lbl:
raise error.Abort(
raise error.InputError(
_(b"%r cannot be used in a name") % pycompat.bytestr(c)
)
try:
int(lbl)
raise error.Abort(_(b"cannot use an integer as a name"))
raise error.InputError(_(b"cannot use an integer as a name"))
except ValueError:
pass
if lbl.strip() != lbl:
raise error.Abort(_(b"leading or trailing whitespace in name %r") % lbl)
raise error.InputError(
_(b"leading or trailing whitespace in name %r") % lbl
)
def checkfilename(f):
......
......@@ -396,15 +396,15 @@ bookmark with reserved name
$ hg bookmark tip
abort: the name 'tip' is reserved
[255]
[10]
$ hg bookmark .
abort: the name '.' is reserved
[255]
[10]
$ hg bookmark null
abort: the name 'null' is reserved
[255]
[10]
bookmark with existing name
......@@ -431,7 +431,7 @@ bookmark with integer name
$ hg bookmark 10
abort: cannot use an integer as a name
[255]
[10]
bookmark with a name that matches a node id
$ hg bookmark 925d80f479bb db815d6d32e6 --config "$TESTHOOK"
......@@ -538,12 +538,12 @@ invalid bookmark
$ hg bookmark 'foo:bar'
abort: ':' cannot be used in a name
[255]
[10]
$ hg bookmark 'foo
> bar'
abort: '\n' cannot be used in a name
[255]
[10]
the bookmark extension should be ignored now that it is part of core
......
......@@ -40,13 +40,13 @@ Setting an invalid branch name
$ hg branch -r . a:b
abort: ':' cannot be used in a name
[255]
[10]
$ hg branch -r . tip
abort: the name 'tip' is reserved
[255]
[10]
$ hg branch -r . 1234
abort: cannot use an integer as a name
[255]
[10]
Change on non-linear set of commits
......
......@@ -51,24 +51,24 @@ reserved names
$ hg branch tip
abort: the name 'tip' is reserved
[255]
[10]
$ hg branch null
abort: the name 'null' is reserved
[255]
[10]
$ hg branch .
abort: the name '.' is reserved
[255]
[10]
invalid characters
$ hg branch 'foo:bar'
abort: ':' cannot be used in a name
[255]
[10]
$ hg branch 'foo
> bar'
abort: '\n' cannot be used in a name
[255]
[10]
trailing or leading spaces should be stripped before testing duplicates
......
......@@ -64,13 +64,13 @@ specified)
[10]
$ hg tag tap nada dot tip
abort: the name 'tip' is reserved
[255]
[10]
$ hg tag .
abort: the name '.' is reserved
[255]
[10]
$ hg tag null
abort: the name 'null' is reserved
[255]
[10]
$ hg tag "bleah"
abort: tag 'bleah' already exists (use -f to force)
[10]
......@@ -157,10 +157,10 @@ tagging on a non-head revision
$ hg tag -l 'xx
> newline'
abort: '\n' cannot be used in a name
[255]
[10]
$ hg tag -l 'xx:xx'
abort: ':' cannot be used in a name
[255]
[10]
cloning local tags
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment