Show More
@@ -297,28 +297,12 b' def _readactive(repo, marks):' | |||||
297 | itself as we commit. This function returns the name of that bookmark. |
|
297 | itself as we commit. This function returns the name of that bookmark. | |
298 | It is stored in .hg/bookmarks.current |
|
298 | It is stored in .hg/bookmarks.current | |
299 | """ |
|
299 | """ | |
300 | try: |
|
300 | # No readline() in osutil.posixfile, reading everything is | |
301 | file = repo.vfs('bookmarks.current') |
|
301 | # cheap. | |
302 | except IOError as inst: |
|
302 | content = repo.vfs.tryread('bookmarks.current') | |
303 | if inst.errno != errno.ENOENT: |
|
303 | mark = encoding.tolocal((content.splitlines() or [''])[0]) | |
304 | raise |
|
304 | if mark == '' or mark not in marks: | |
305 |
|
|
305 | mark = None | |
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() |
|
|||
322 | return mark |
|
306 | return mark | |
323 |
|
307 | |||
324 | def activate(repo, mark): |
|
308 | def activate(repo, mark): |
General Comments 0
You need to be logged in to leave comments.
Login now