Patchwork D9385: errors: raise InputError on bad bookmark argument

login
register
mail settings
Submitter phabricator
Date Nov. 24, 2020, 6:07 p.m.
Message ID <differential-rev-PHID-DREV-potcisuivt3w2klpjsz3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47663/
State Superseded
Headers show

Comments

phabricator - Nov. 24, 2020, 6:07 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9385

AFFECTED FILES
  mercurial/bookmarks.py
  tests/test-bookmarks.t
  tests/test-http-permissions.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-http-permissions.t b/tests/test-http-permissions.t
--- a/tests/test-http-permissions.t
+++ b/tests/test-http-permissions.t
@@ -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
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -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
 
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -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