changeset 7259:18c23375861f

bookmarks: Correctly reject newlines in bookmark names Without this fix, a single newline is a valid bookmark name since strip() removes it.
author Joel Rosdahl <joel@rosdahl.net>
date Sat, 25 Oct 2008 19:05:52 +0200
parents 9bd051efbdd6
children eb91b9ce2c19
files hgext/bookmarks.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/bookmarks.py	Sat Oct 25 19:05:52 2008 +0200
+++ b/hgext/bookmarks.py	Sat Oct 25 19:05:52 2008 +0200
@@ -98,8 +98,8 @@
         return
 
     if mark != None:
-        if mark.strip().count("\n") > 0:
-            raise Exception("bookmark cannot contain newlines")
+        if "\n" in mark:
+            raise util.Abort(_("bookmark name cannot contain newlines"))
         if mark in marks and not force:
             raise util.Abort(_("a bookmark of the same name already exists"))
         if ((mark in repo.branchtags() or mark == repo.dirstate.branch())