[PATCH 2 of 9] bookmarks: remove redundant check for newline

Kevin Bullock kbullock+mercurial at ringworld.org
Wed Oct 17 22:31:42 CDT 2012


# HG changeset patch
# User Kevin Bullock <kbullock at ringworld.org>
# Date 1350509022 18000
# Node ID f1b6af2759a9790945b058faab1f43cb3efd7bd7
# Parent  616d0b790fc95633827f10055730888b73d5c80d
bookmarks: remove redundant check for newline

New bookmarks are already checked for illegal characters (':', '\0',
'\n', and '\r') in bookmarks.valid().

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -790,8 +790,6 @@ def bookmark(ui, repo, mark=None, rev=No
     cur   = repo.changectx('.').node()
 
     def checkformat(mark):
-        if "\n" in mark:
-            raise util.Abort(_("bookmark name cannot contain newlines"))
         mark = mark.strip()
         if not mark:
             raise util.Abort(_("bookmark names cannot consist entirely of "
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -214,12 +214,12 @@ reject bookmark name with newline
 
   $ hg bookmark '
   > '
-  abort: bookmark name cannot contain newlines
+  abort: bookmark names cannot consist entirely of whitespace
   [255]
 
   $ hg bookmark -m Z '
   > '
-  abort: bookmark name cannot contain newlines
+  abort: bookmark names cannot consist entirely of whitespace
   [255]
 
 bookmark with existing name


More information about the Mercurial-devel mailing list