This is an archive of the discontinued Mercurial Phabricator instance.

hg-core: check data integrity in `Revlog`
ClosedPublic

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

Details

Summary

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

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

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.

rust/hg-core/src/revlog/revlog.rs
20

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

291

Same as above, reuse the 20 constant from somewhere else

acezar added inline comments.Sep 18 2020, 9:02 AM
rust/hg-core/src/revlog/revlog.rs
20

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

291

well hg-core/src/dirstate/dirstate_map.rs 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.