##// END OF EJS Templates
bookmarks: make _readactive safe when readlines raises ENOENT...
Augie Fackler -
r27685:9fbae70f default
parent child Browse files
Show More
@@ -165,10 +165,19 b' def readactive(repo):'
165 raise
165 raise
166 return None
166 return None
167 try:
167 try:
168 # No readline() in osutil.posixfile, reading everything is cheap
168 # No readline() in osutil.posixfile, reading everything is
169 # cheap.
170 # Note that it's possible for readlines() here to raise
171 # IOError, since we might be reading the active mark over
172 # static-http which only tries to load the file when we try
173 # to read from it.
169 mark = encoding.tolocal((file.readlines() or [''])[0])
174 mark = encoding.tolocal((file.readlines() or [''])[0])
170 if mark == '' or mark not in repo._bookmarks:
175 if mark == '' or mark not in repo._bookmarks:
171 mark = None
176 mark = None
177 except IOError as inst:
178 if inst.errno != errno.ENOENT:
179 raise
180 return None
172 finally:
181 finally:
173 file.close()
182 file.close()
174 return mark
183 return mark
General Comments 0
You need to be logged in to leave comments. Login now