# HG changeset patch # User Matt Mackall # Date 1392670196 21600 # Node ID 28b8ff84db3f94abef30df6f9cbbf0027a1bd8c7 # Parent 0e2877f8605dcaf4fdf2ab7e0046f1f6f80161dd journal: report parsing errors on recover/rollback (issue4172) diff -r 0e2877f8605d -r 28b8ff84db3f mercurial/transaction.py --- a/mercurial/transaction.py Sat Feb 15 22:09:32 2014 -0600 +++ b/mercurial/transaction.py Mon Feb 17 14:49:56 2014 -0600 @@ -174,7 +174,10 @@ lines = fp.readlines() fp.close() for l in lines: - f, o = l.split('\0') - entries.append((f, int(o), None)) + try: + f, o = l.split('\0') + entries.append((f, int(o), None)) + except ValueError: + report(_("couldn't read journal entry %r!\n") % l) _playback(file, report, opener, entries) diff -r 0e2877f8605d -r 28b8ff84db3f tests/test-rollback.t --- a/tests/test-rollback.t Sat Feb 15 22:09:32 2014 -0600 +++ b/tests/test-rollback.t Mon Feb 17 14:49:56 2014 -0600 @@ -184,4 +184,14 @@ $ cat a a - $ cd .. +corrupt journal test + $ echo "foo" > .hg/store/journal + $ hg recover + rolling back interrupted transaction + couldn't read journal entry 'foo\n'! + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 1 files, 2 changesets, 2 total revisions +