comparison hgext/bookmarks.py @ 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
comparison
equal deleted inserted replaced
7258:9bd051efbdd6 7259:18c23375861f
96 del marks[mark] 96 del marks[mark]
97 write(repo, marks) 97 write(repo, marks)
98 return 98 return
99 99
100 if mark != None: 100 if mark != None:
101 if mark.strip().count("\n") > 0: 101 if "\n" in mark:
102 raise Exception("bookmark cannot contain newlines") 102 raise util.Abort(_("bookmark name cannot contain newlines"))
103 if mark in marks and not force: 103 if mark in marks and not force:
104 raise util.Abort(_("a bookmark of the same name already exists")) 104 raise util.Abort(_("a bookmark of the same name already exists"))
105 if ((mark in repo.branchtags() or mark == repo.dirstate.branch()) 105 if ((mark in repo.branchtags() or mark == repo.dirstate.branch())
106 and not force): 106 and not force):
107 raise util.Abort( 107 raise util.Abort(