# HG changeset patch # User Pierre-Yves David # Date 2011-07-05 08:20:27 # Node ID 5097d8b5078ca1cab7d0d9f8fb8d5b9896e401b7 # Parent 677339529a53a98e0bfb7b2ddfd715d3ef0f62f5 bookmarks: add a warning for non empty malformed line diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -28,6 +28,9 @@ def read(repo): for line in repo.opener('bookmarks'): line = line.strip() if ' ' not in line: + if line: + msg = _('malformed line in .hg/bookmarks: %r\n') + repo.ui.warn( msg % line) continue sha, refspec = line.strip().split(' ', 1) refspec = encoding.tolocal(refspec) diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t --- a/tests/test-bookmarks.t +++ b/tests/test-bookmarks.t @@ -350,3 +350,11 @@ test wrongly formated bookmark Y 2:db815d6d32e6 * Z 3:125c9a1d6df6 x y 2:db815d6d32e6 + $ echo "Ican'thasformatedlines" >> .hg/bookmarks + $ hg bookmarks + malformed line in .hg/bookmarks: "Ican'thasformatedlines" + X2 1:925d80f479bb + Y 2:db815d6d32e6 + * Z 3:125c9a1d6df6 + x y 2:db815d6d32e6 +