Show More
@@ -297,28 +297,12 b' def _readactive(repo, marks):' | |||
|
297 | 297 | itself as we commit. This function returns the name of that bookmark. |
|
298 | 298 | It is stored in .hg/bookmarks.current |
|
299 | 299 | """ |
|
300 | try: | |
|
301 | file = repo.vfs('bookmarks.current') | |
|
302 | except IOError as inst: | |
|
303 | if inst.errno != errno.ENOENT: | |
|
304 | raise | |
|
305 |
|
|
|
306 | try: | |
|
307 | # No readline() in osutil.posixfile, reading everything is | |
|
308 | # cheap. | |
|
309 | # Note that it's possible for readlines() here to raise | |
|
310 | # IOError, since we might be reading the active mark over | |
|
311 | # static-http which only tries to load the file when we try | |
|
312 | # to read from it. | |
|
313 | mark = encoding.tolocal((file.readlines() or [''])[0]) | |
|
314 | if mark == '' or mark not in marks: | |
|
315 | mark = None | |
|
316 | except IOError as inst: | |
|
317 | if inst.errno != errno.ENOENT: | |
|
318 | raise | |
|
319 | return None | |
|
320 | finally: | |
|
321 | file.close() | |
|
300 | # No readline() in osutil.posixfile, reading everything is | |
|
301 | # cheap. | |
|
302 | content = repo.vfs.tryread('bookmarks.current') | |
|
303 | mark = encoding.tolocal((content.splitlines() or [''])[0]) | |
|
304 | if mark == '' or mark not in marks: | |
|
305 | mark = None | |
|
322 | 306 | return mark |
|
323 | 307 | |
|
324 | 308 | def activate(repo, mark): |
General Comments 0
You need to be logged in to leave comments.
Login now