##// END OF EJS Templates
bookmarks: abort directly on invalid name...
Kevin Bullock -
r17815:be146734 default
parent child Browse files
Show More
@@ -10,11 +10,11 b' from mercurial.node import hex'
10 10 from mercurial import encoding, error, util, obsolete, phases
11 11 import errno, os
12 12
13 def valid(mark):
13 def checkvalid(mark):
14 14 for c in (':', '\0', '\n', '\r'):
15 15 if c in mark:
16 return False
17 return True
16 raise util.Abort(_("bookmark '%s' contains illegal "
17 "character" % mark))
18 18
19 19 def read(repo):
20 20 '''Parse .hg/bookmarks file and return a dictionary
@@ -80,9 +80,7 b' def write(repo):'
80 80 if repo._bookmarkcurrent not in refs:
81 81 setcurrent(repo, None)
82 82 for mark in refs.keys():
83 if not valid(mark):
84 raise util.Abort(_("bookmark '%s' contains illegal "
85 "character" % mark))
83 checkvalid(mark)
86 84
87 85 wlock = repo.wlock()
88 86 try:
@@ -113,9 +111,7 b' def setcurrent(repo, mark):'
113 111
114 112 if mark not in repo._bookmarks:
115 113 mark = ''
116 if not valid(mark):
117 raise util.Abort(_("bookmark '%s' contains illegal "
118 "character" % mark))
114 checkvalid(mark)
119 115
120 116 wlock = repo.wlock()
121 117 try:
General Comments 0
You need to be logged in to leave comments. Login now