# HG changeset patch # User Matt Mackall # Date 2014-02-17 20:49:56 # Node ID 28b8ff84db3f94abef30df6f9cbbf0027a1bd8c7 # Parent 0e2877f8605dcaf4fdf2ab7e0046f1f6f80161dd journal: report parsing errors on recover/rollback (issue4172) diff --git a/mercurial/transaction.py b/mercurial/transaction.py --- a/mercurial/transaction.py +++ b/mercurial/transaction.py @@ -174,7 +174,10 @@ def rollback(opener, file, report): 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 --git a/tests/test-rollback.t b/tests/test-rollback.t --- a/tests/test-rollback.t +++ b/tests/test-rollback.t @@ -184,4 +184,14 @@ same again, but emulate an old client th $ 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 +