This is an archive of the discontinued Mercurial Phabricator instance.

revlog: abort on attempt to write null revision
ClosedPublic

Authored by martinvonz on Aug 25 2017, 6:59 PM.

Details

Summary

My repo got corrupted yesterday by something that ended up writing the
null revision to the revlog (nullid hash, not nullrev index, of
course). We use many extensions internally (narrowhg, remotefilelog,
evolve, internal extensions) and treemanifests are on. The null
revision was written to the changelog, the root manifest log, and one
subdirectory manifest log. I have no idea exactly why the null
revision was written, but it seems cheap enough to check that we
should fail instead of corrupting the repo.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Aug 25 2017, 6:59 PM
quark accepted this revision.Aug 25 2017, 7:27 PM
quark added a subscriber: quark.

Looks good to me. Maybe we also want to blacklist the working copy node.

quark resigned from this revision.Aug 25 2017, 7:28 PM

Actually, I think it's better to do this in _addrevision, which could cover more code paths in theory.

In D522#8435, @quark wrote:

Looks good to me. Maybe we also want to blacklist the working copy node.

Makes sense. It's slightly different since it only applies to the changelog (but there are also several other magic hashes for manifests), so I'll do it a separate patch to avoid holding this patch hostage.

In D522#8437, @quark wrote:

Actually, I think it's better to do this in _addrevision, which could cover more code paths in theory.

Good point. I'll move it there.

martinvonz updated this revision to Diff 1319.Aug 26 2017, 12:59 AM
quark accepted this revision.Aug 26 2017, 11:58 AM
This revision was automatically updated to reflect the committed changes.