diff mercurial/bookmarks.py @ 13627:71a96f6c205d stable

bookmarks: discard current bookmark if absent from the bookmarks (issue2692) After a rollback, the current bookmark might be absent from the bookmarks file. In that case we discard it instead of displaying a traceback during commit.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 13 Mar 2011 14:36:47 +0100
parents c631ac076375
children 31eac42d9123 89e7d35e0ef0
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Sun Mar 13 16:13:25 2011 +0100
+++ b/mercurial/bookmarks.py	Sun Mar 13 14:36:47 2011 +0100
@@ -45,7 +45,7 @@
         file = repo.opener('bookmarks.current')
         # No readline() in posixfile_nt, reading everything is cheap
         mark = encoding.tolocal((file.readlines() or [''])[0])
-        if mark == '':
+        if mark == '' or mark not in repo._bookmarks:
             mark = None
         file.close()
     return mark