[PATCH] bookmarks: change error messages to match those given by 'hg tag' commands

Idan Kamara idankk86 at gmail.com
Thu Apr 7 11:50:46 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1302188258 -10800
# Node ID 9adf82e2fe4cfd0c5af82b3b2879333145c3249e
# Parent  8be010d216d16ce2fb8a25121d55a3d90d62ce16
bookmarks: change error messages to match those given by 'hg tag' commands

diff -r 8be010d216d1 -r 9adf82e2fe4c mercurial/commands.py
--- a/mercurial/commands.py	Thu Apr 07 17:16:17 2011 +0300
+++ 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(
diff -r 8be010d216d1 -r 9adf82e2fe4c tests/test-bookmarks.t
--- a/tests/test-bookmarks.t	Thu Apr 07 17:16:17 2011 +0300
+++ 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


More information about the Mercurial-devel mailing list