Joel Rosdahl committed 18c2337

bookmarks: Correctly reject newlines in bookmark names

Without this fix, a single newline is a valid bookmark name since
strip() removes it.

  • Participants
  • Parent commits 9bd051e

Comments (0)

Files changed (1)

File hgext/

     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())