##// END OF EJS Templates
bookmarks: don't allow name to contain whitespaces only
Idan Kamara -
r11704:18c47562 stable
parent child Browse files
Show More
@@ -136,6 +136,9 b' def bookmark(ui, repo, mark=None, rev=No'
136 if "\n" in mark:
136 if "\n" in mark:
137 raise util.Abort(_("bookmark name cannot contain newlines"))
137 raise util.Abort(_("bookmark name cannot contain newlines"))
138 mark = mark.strip()
138 mark = mark.strip()
139 if not mark:
140 raise util.Abort(_("bookmark names cannot consist entirely of "
141 "whitespace"))
139 if mark in marks and not force:
142 if mark in marks and not force:
140 raise util.Abort(_("a bookmark of the same name already exists"))
143 raise util.Abort(_("a bookmark of the same name already exists"))
141 if ((mark in repo.branchtags() or mark == repo.dirstate.branch())
144 if ((mark in repo.branchtags() or mark == repo.dirstate.branch())
@@ -100,4 +100,7 b' hg bookmark'
100 echo % revision but no bookmark name
100 echo % revision but no bookmark name
101 hg bookmark -r .
101 hg bookmark -r .
102
102
103 echo % bookmark name with whitespace only
104 hg bookmark ' '
105
103 true
106 true
@@ -74,3 +74,5 b' abort: a bookmark of the same name alrea'
74 * x y 2:0316ce92851d
74 * x y 2:0316ce92851d
75 % revision but no bookmark name
75 % revision but no bookmark name
76 abort: bookmark name required
76 abort: bookmark name required
77 % bookmark name with whitespace only
78 abort: bookmark names cannot consist entirely of whitespace
General Comments 0
You need to be logged in to leave comments. Login now