changeset 45913:9acbe30953e8

errors: raise InputError on bad bookmark argument Differential Revision: https://phab.mercurial-scm.org/D9385
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 17 Nov 2020 16:32:03 -0800
parents 35ab6e39f482
children be25b66f86ab
files mercurial/bookmarks.py tests/test-bookmarks.t tests/test-http-permissions.t
diffstat 3 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Mon Nov 23 12:27:22 2020 -0800
+++ b/mercurial/bookmarks.py	Tue Nov 17 16:32:03 2020 -0800
@@ -901,7 +901,7 @@
     """
     mark = mark.strip()
     if not mark:
-        raise error.Abort(
+        raise error.InputError(
             _(b"bookmark names cannot consist entirely of whitespace")
         )
     scmutil.checknewlabel(repo, mark, b'bookmark')
@@ -917,7 +917,7 @@
     changes = []
     for mark in names:
         if mark not in marks:
-            raise error.Abort(_(b"bookmark '%s' does not exist") % mark)
+            raise error.InputError(_(b"bookmark '%s' does not exist") % mark)
         if mark == repo._activebookmark:
             deactivate(repo)
         changes.append((mark, None))
@@ -937,7 +937,7 @@
     marks = repo._bookmarks
     mark = checkformat(repo, new)
     if old not in marks:
-        raise error.Abort(_(b"bookmark '%s' does not exist") % old)
+        raise error.InputError(_(b"bookmark '%s' does not exist") % old)
     changes = []
     for bm in marks.checkconflict(mark, force):
         changes.append((bm, None))
@@ -1041,7 +1041,7 @@
     bmarks = {}
     for bmark in names or marks:
         if bmark not in marks:
-            raise error.Abort(_(b"bookmark '%s' does not exist") % bmark)
+            raise error.InputError(_(b"bookmark '%s' does not exist") % bmark)
         active = repo._activebookmark
         if bmark == active:
             prefix, label = b'*', activebookmarklabel
--- a/tests/test-bookmarks.t	Mon Nov 23 12:27:22 2020 -0800
+++ b/tests/test-bookmarks.t	Tue Nov 17 16:32:03 2020 -0800
@@ -79,7 +79,7 @@
    * X2                        0:f7b1eb17ad24
   $ hg bookmarks -l X A Y
   abort: bookmark 'A' does not exist
-  [255]
+  [10]
   $ hg bookmarks -l -r0
   abort: cannot specify both --list and --rev
   [10]
@@ -245,7 +245,7 @@
 
   $ hg bookmark -m A B
   abort: bookmark 'A' does not exist
-  [255]
+  [10]
 
 rename to existent bookmark
 
@@ -342,7 +342,7 @@
 
   $ hg bookmark -d A
   abort: bookmark 'A' does not exist
-  [255]
+  [10]
 
 delete with --inactive
 
@@ -385,12 +385,12 @@
   $ hg bookmark '
   > '
   abort: bookmark names cannot consist entirely of whitespace
-  [255]
+  [10]
 
   $ hg bookmark -m Z '
   > '
   abort: bookmark names cannot consist entirely of whitespace
-  [255]
+  [10]
 
 bookmark with reserved name
 
@@ -528,11 +528,11 @@
 
   $ hg bookmark ' '
   abort: bookmark names cannot consist entirely of whitespace
-  [255]
+  [10]
 
   $ hg bookmark -m Y ' '
   abort: bookmark names cannot consist entirely of whitespace
-  [255]
+  [10]
 
 invalid bookmark
 
--- a/tests/test-http-permissions.t	Mon Nov 23 12:27:22 2020 -0800
+++ b/tests/test-http-permissions.t	Tue Nov 17 16:32:03 2020 -0800
@@ -765,7 +765,7 @@
   no bookmarks set
   $ hg bookmark -d bm
   abort: bookmark 'bm' does not exist
-  [255]
+  [10]
 
   $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
   405 push requires POST request
@@ -806,7 +806,7 @@
   no bookmarks set
   $ hg bookmark -d bm
   abort: bookmark 'bm' does not exist
-  [255]
+  [10]
 
   $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=customwritenoperm'
   405 push requires POST request