comparison mercurial/bookmarks.py @ 14845:677339529a53

bookmarks: more robust parsing of bookmarks file
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 05 Jul 2011 10:13:54 +0200
parents e29821ca94cf
children 5097d8b5078c
comparison
equal deleted inserted replaced
14844:7aaae5466ad3 14845:677339529a53
24 Read the file and return a (name=>nodeid) dictionary 24 Read the file and return a (name=>nodeid) dictionary
25 ''' 25 '''
26 bookmarks = {} 26 bookmarks = {}
27 try: 27 try:
28 for line in repo.opener('bookmarks'): 28 for line in repo.opener('bookmarks'):
29 line = line.strip()
30 if ' ' not in line:
31 continue
29 sha, refspec = line.strip().split(' ', 1) 32 sha, refspec = line.strip().split(' ', 1)
30 refspec = encoding.tolocal(refspec) 33 refspec = encoding.tolocal(refspec)
31 try: 34 try:
32 bookmarks[refspec] = repo.changelog.lookup(sha) 35 bookmarks[refspec] = repo.changelog.lookup(sha)
33 except error.RepoLookupError: 36 except error.RepoLookupError: