bookmarks: change error messages to match those given by 'hg tag' commands
authorIdan Kamara <idankk86@gmail.com>
Thu, 07 Apr 2011 17:57:38 +0300
changeset 13911 6bc340940c18
parent 13910 93452579df9e
child 13913 d3f90ff904b8
bookmarks: change error messages to match those given by 'hg tag' commands
mercurial/commands.py
tests/test-bookmarks.t
--- a/mercurial/commands.py	Thu Apr 07 14:43:19 2011 -0500
+++ b/mercurial/commands.py	Thu Apr 07 17:57:38 2011 +0300
@@ -507,9 +507,10 @@
 
     if rename:
         if rename not in marks:
-            raise util.Abort(_("a bookmark of this name does not exist"))
+            raise util.Abort(_("bookmark '%s' does not exist") % rename)
         if mark in marks and not force:
-            raise util.Abort(_("a bookmark of the same name already exists"))
+            raise util.Abort(_("bookmark '%s' already exists "
+                               "(use -f to force)") % mark)
         if mark is None:
             raise util.Abort(_("new bookmark name required"))
         marks[mark] = marks[rename]
@@ -523,7 +524,7 @@
         if mark is None:
             raise util.Abort(_("bookmark name required"))
         if mark not in marks:
-            raise util.Abort(_("a bookmark of this name does not exist"))
+            raise util.Abort(_("bookmark '%s' does not exist") % mark)
         if mark == repo._bookmarkcurrent:
             bookmarks.setcurrent(repo, None)
         del marks[mark]
@@ -538,7 +539,8 @@
             raise util.Abort(_("bookmark names cannot consist entirely of "
                                "whitespace"))
         if mark in marks and not force:
-            raise util.Abort(_("a bookmark of the same name already exists"))
+            raise util.Abort(_("bookmark '%s' already exists "
+                               "(use -f to force)") % mark)
         if ((mark in repo.branchtags() or mark == repo.dirstate.branch())
             and not force):
             raise util.Abort(
--- a/tests/test-bookmarks.t	Thu Apr 07 14:43:19 2011 -0500
+++ b/tests/test-bookmarks.t	Thu Apr 07 17:57:38 2011 +0300
@@ -116,13 +116,13 @@
 rename nonexistent bookmark
 
   $ hg bookmark -m A B
-  abort: a bookmark of this name does not exist
+  abort: bookmark 'A' does not exist
   [255]
 
 rename to existent bookmark
 
   $ hg bookmark -m X Y
-  abort: a bookmark of the same name already exists
+  abort: bookmark 'Y' already exists (use -f to force)
   [255]
 
 force rename to existent bookmark
@@ -151,7 +151,7 @@
 delete nonexistent bookmark
 
   $ hg bookmark -d A
-  abort: a bookmark of this name does not exist
+  abort: bookmark 'A' does not exist
   [255]
 
 bookmark name with spaces should be stripped
@@ -189,7 +189,7 @@
 bookmark with existing name
 
   $ hg bookmark Z
-  abort: a bookmark of the same name already exists
+  abort: bookmark 'Z' already exists (use -f to force)
   [255]
 
 force bookmark with existing name