comparison 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
comparison
equal deleted inserted replaced
13626:4e96a5bee10d 13627:71a96f6c205d
43 mark = None 43 mark = None
44 if os.path.exists(repo.join('bookmarks.current')): 44 if os.path.exists(repo.join('bookmarks.current')):
45 file = repo.opener('bookmarks.current') 45 file = repo.opener('bookmarks.current')
46 # No readline() in posixfile_nt, reading everything is cheap 46 # No readline() in posixfile_nt, reading everything is cheap
47 mark = encoding.tolocal((file.readlines() or [''])[0]) 47 mark = encoding.tolocal((file.readlines() or [''])[0])
48 if mark == '': 48 if mark == '' or mark not in repo._bookmarks:
49 mark = None 49 mark = None
50 file.close() 50 file.close()
51 return mark 51 return mark
52 52
53 def write(repo): 53 def write(repo):