##// END OF EJS Templates
errors: use InputError for errors about bad label names (tags etc)...
Martin von Zweigbergk -
r46449:f96fa4de default
parent child Browse files
Show More
@@ -293,19 +293,21 b' def checknewlabel(repo, lbl, kind):'
293 # Do not use the "kind" parameter in ui output.
293 # Do not use the "kind" parameter in ui output.
294 # It makes strings difficult to translate.
294 # It makes strings difficult to translate.
295 if lbl in [b'tip', b'.', b'null']:
295 if lbl in [b'tip', b'.', b'null']:
296 raise error.Abort(_(b"the name '%s' is reserved") % lbl)
296 raise error.InputError(_(b"the name '%s' is reserved") % lbl)
297 for c in (b':', b'\0', b'\n', b'\r'):
297 for c in (b':', b'\0', b'\n', b'\r'):
298 if c in lbl:
298 if c in lbl:
299 raise error.Abort(
299 raise error.InputError(
300 _(b"%r cannot be used in a name") % pycompat.bytestr(c)
300 _(b"%r cannot be used in a name") % pycompat.bytestr(c)
301 )
301 )
302 try:
302 try:
303 int(lbl)
303 int(lbl)
304 raise error.Abort(_(b"cannot use an integer as a name"))
304 raise error.InputError(_(b"cannot use an integer as a name"))
305 except ValueError:
305 except ValueError:
306 pass
306 pass
307 if lbl.strip() != lbl:
307 if lbl.strip() != lbl:
308 raise error.Abort(_(b"leading or trailing whitespace in name %r") % lbl)
308 raise error.InputError(
309 _(b"leading or trailing whitespace in name %r") % lbl
310 )
309
311
310
312
311 def checkfilename(f):
313 def checkfilename(f):
@@ -396,15 +396,15 b' bookmark with reserved name'
396
396
397 $ hg bookmark tip
397 $ hg bookmark tip
398 abort: the name 'tip' is reserved
398 abort: the name 'tip' is reserved
399 [255]
399 [10]
400
400
401 $ hg bookmark .
401 $ hg bookmark .
402 abort: the name '.' is reserved
402 abort: the name '.' is reserved
403 [255]
403 [10]
404
404
405 $ hg bookmark null
405 $ hg bookmark null
406 abort: the name 'null' is reserved
406 abort: the name 'null' is reserved
407 [255]
407 [10]
408
408
409
409
410 bookmark with existing name
410 bookmark with existing name
@@ -431,7 +431,7 b' bookmark with integer name'
431
431
432 $ hg bookmark 10
432 $ hg bookmark 10
433 abort: cannot use an integer as a name
433 abort: cannot use an integer as a name
434 [255]
434 [10]
435
435
436 bookmark with a name that matches a node id
436 bookmark with a name that matches a node id
437 $ hg bookmark 925d80f479bb db815d6d32e6 --config "$TESTHOOK"
437 $ hg bookmark 925d80f479bb db815d6d32e6 --config "$TESTHOOK"
@@ -538,12 +538,12 b' invalid bookmark'
538
538
539 $ hg bookmark 'foo:bar'
539 $ hg bookmark 'foo:bar'
540 abort: ':' cannot be used in a name
540 abort: ':' cannot be used in a name
541 [255]
541 [10]
542
542
543 $ hg bookmark 'foo
543 $ hg bookmark 'foo
544 > bar'
544 > bar'
545 abort: '\n' cannot be used in a name
545 abort: '\n' cannot be used in a name
546 [255]
546 [10]
547
547
548 the bookmark extension should be ignored now that it is part of core
548 the bookmark extension should be ignored now that it is part of core
549
549
@@ -40,13 +40,13 b' Setting an invalid branch name'
40
40
41 $ hg branch -r . a:b
41 $ hg branch -r . a:b
42 abort: ':' cannot be used in a name
42 abort: ':' cannot be used in a name
43 [255]
43 [10]
44 $ hg branch -r . tip
44 $ hg branch -r . tip
45 abort: the name 'tip' is reserved
45 abort: the name 'tip' is reserved
46 [255]
46 [10]
47 $ hg branch -r . 1234
47 $ hg branch -r . 1234
48 abort: cannot use an integer as a name
48 abort: cannot use an integer as a name
49 [255]
49 [10]
50
50
51 Change on non-linear set of commits
51 Change on non-linear set of commits
52
52
@@ -51,24 +51,24 b' reserved names'
51
51
52 $ hg branch tip
52 $ hg branch tip
53 abort: the name 'tip' is reserved
53 abort: the name 'tip' is reserved
54 [255]
54 [10]
55 $ hg branch null
55 $ hg branch null
56 abort: the name 'null' is reserved
56 abort: the name 'null' is reserved
57 [255]
57 [10]
58 $ hg branch .
58 $ hg branch .
59 abort: the name '.' is reserved
59 abort: the name '.' is reserved
60 [255]
60 [10]
61
61
62 invalid characters
62 invalid characters
63
63
64 $ hg branch 'foo:bar'
64 $ hg branch 'foo:bar'
65 abort: ':' cannot be used in a name
65 abort: ':' cannot be used in a name
66 [255]
66 [10]
67
67
68 $ hg branch 'foo
68 $ hg branch 'foo
69 > bar'
69 > bar'
70 abort: '\n' cannot be used in a name
70 abort: '\n' cannot be used in a name
71 [255]
71 [10]
72
72
73 trailing or leading spaces should be stripped before testing duplicates
73 trailing or leading spaces should be stripped before testing duplicates
74
74
@@ -64,13 +64,13 b' specified)'
64 [10]
64 [10]
65 $ hg tag tap nada dot tip
65 $ hg tag tap nada dot tip
66 abort: the name 'tip' is reserved
66 abort: the name 'tip' is reserved
67 [255]
67 [10]
68 $ hg tag .
68 $ hg tag .
69 abort: the name '.' is reserved
69 abort: the name '.' is reserved
70 [255]
70 [10]
71 $ hg tag null
71 $ hg tag null
72 abort: the name 'null' is reserved
72 abort: the name 'null' is reserved
73 [255]
73 [10]
74 $ hg tag "bleah"
74 $ hg tag "bleah"
75 abort: tag 'bleah' already exists (use -f to force)
75 abort: tag 'bleah' already exists (use -f to force)
76 [10]
76 [10]
@@ -157,10 +157,10 b' tagging on a non-head revision'
157 $ hg tag -l 'xx
157 $ hg tag -l 'xx
158 > newline'
158 > newline'
159 abort: '\n' cannot be used in a name
159 abort: '\n' cannot be used in a name
160 [255]
160 [10]
161 $ hg tag -l 'xx:xx'
161 $ hg tag -l 'xx:xx'
162 abort: ':' cannot be used in a name
162 abort: ':' cannot be used in a name
163 [255]
163 [10]
164
164
165 cloning local tags
165 cloning local tags
166
166
General Comments 0
You need to be logged in to leave comments. Login now