D522: revlog: abort on attempt to write null revision
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Aug 25 22:59:18 UTC 2017
martinvonz created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION 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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D522
AFFECTED FILES
mercurial/revlog.py
CHANGE DETAILS
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1575,6 +1575,9 @@
useful when reusing a revision not stored in this revlog (ex: received
over wire, or read from an external bundle).
"""
+ if node == nullid:
+ raise RevlogError(_("%s: attempt to add null revision") %
+ (self.indexfile))
dfh = None
if not self._inline:
dfh = self.opener(self.datafile, "a+")
To: martinvonz, indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list