This is an archive of the discontinued Mercurial Phabricator instance.

rust: Align DirstateEntry internals with Python/C DirstateItem
ClosedPublic

Authored by SimonSapin on Sep 22 2021, 4:55 PM.

Details

Summary

This propagate to this Rust struct the similar change that was made recently
to the Python classe and C struct. Namely, instead of storing a four-valued
state field we now store seven (bit-packed) booleans that give lower-level
information.

Additionally, the marker values -1 and -2 for mtime and size should not
be used internally anymore. They are replaced by some combinations of booleans

For now, all uses of of DirstateEntry still use the compatibility APIs
with state and marker values. Later the Rust API for DirstateMap
will be increasingly updated to the new style.

Also change the expected result of the test_non_normal_other_parent_entries
unit test. Only a DirstateEntry with size == -2 && mtime != -1 is
affected, but this case never occurs outside of unit tests.
size == -2 was the marker value for "from other parent" entries,
where no meaningful mtime is stored.

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

SimonSapin created this revision.Sep 22 2021, 4:55 PM
Alphare accepted this revision.Sep 23 2021, 11:07 AM
Alphare added a subscriber: Alphare.
Alphare added inline comments.
rust/Cargo.lock
3

That's my bad, I didn't check when amending the other changeset. We'll let it live inside this changeset since it doesn't matter other than being annoying.

This revision is now accepted and ready to land.Sep 23 2021, 11:07 AM

Note that every commit description has a capital letter after the topic Align should be align, or check-code will complain.