This is an archive of the discontinued Mercurial Phabricator instance.

hg-core: check data integrity in `Revlog`

Authored by acezar on Sep 10 2020, 5:48 AM.



Check that the hash of the data reconstructed from deltas
matches the hash stored in the revision.

Diff Detail

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

Event Timeline

acezar created this revision.Sep 10 2020, 5:48 AM
Alphare accepted this revision.Sep 17 2020, 5:47 AM
Alphare added a subscriber: Alphare.

Both remarks are nits and can be addressed later if need be, this looks good otherwise.


We have at least two other definitions of this in the Rust code. hg-core/src/dirstate/ and `hg-core/src/revlog/ It would be better to factor these out. If you want to do it in a follow-up I understand (less churn).


Same as above, reuse the 20 constant from somewhere else

acezar added inline comments.Sep 18 2020, 9:02 AM

did not found NULL_ID because it's about the node so I searched in hg-core/src/revlog/ with no luck.


well hg-core/src/dirstate/ did not reuse the 20 constant from somewhere else (aka revlog::node::NODE_BYTES_LENGTH) . Not to say that it should not be done, but that staying aware of all existing constants from somewhere else is not that simple.

proposal: have NULL_NODE_ID in the same place than NODE_BYTES_LENGTH and have them public.

acezar updated this revision to Diff 22748.Sep 21 2020, 5:08 AM
acezar marked 2 inline comments as done.Sep 21 2020, 5:11 AM
acezar updated this revision to Diff 22783.Sep 23 2020, 8:23 AM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.