Mercurial > hg-stable
changeset 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 | 7aaae5466ad3 |
children | 5097d8b5078c |
files | mercurial/bookmarks.py tests/test-bookmarks.t |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bookmarks.py Wed Jul 06 19:25:53 2011 -0500 +++ b/mercurial/bookmarks.py Tue Jul 05 10:13:54 2011 +0200 @@ -26,6 +26,9 @@ bookmarks = {} try: for line in repo.opener('bookmarks'): + line = line.strip() + if ' ' not in line: + continue sha, refspec = line.strip().split(' ', 1) refspec = encoding.tolocal(refspec) try:
--- a/tests/test-bookmarks.t Wed Jul 06 19:25:53 2011 -0500 +++ b/tests/test-bookmarks.t Tue Jul 05 10:13:54 2011 +0200 @@ -342,3 +342,11 @@ * Z 3:125c9a1d6df6 x y 2:db815d6d32e6 +test wrongly formated bookmark + + $ echo '' >> .hg/bookmarks + $ hg bookmarks + X2 1:925d80f479bb + Y 2:db815d6d32e6 + * Z 3:125c9a1d6df6 + x y 2:db815d6d32e6