This is an archive of the discontinued Mercurial Phabricator instance.

dirstate-tree: Add the new `status()` algorithm
ClosedPublic

Authored by SimonSapin on May 3 2021, 6:25 AM.

Details

Summary

With the dirstate organized in a tree that mirrors the structure of the
filesystem tree, we can traverse both trees at the same time in order to
compare them. This is hopefully more efficient that building multiple
big hashmaps for all of the repository’s contents.

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.May 3 2021, 6:25 AM
Alphare added inline comments.
rust/hg-core/src/dirstate_tree/status.rs
209

See https://bz.mercurial-scm.org/show_bug.cgi?id=6456 about adding the edge case for symlinks on an encrypted ext4.

243

I might expect the compiler to be clever enough to optimize the if out of the directory case, but maybe not?

359

Shouldn't there be a call to a sort_*() method somewhere in there? I know it's sorted after the call, but either the docstring or the code is wrong.

SimonSapin marked 2 inline comments as done.May 6 2021, 5:47 AM
SimonSapin added inline comments.
rust/hg-core/src/dirstate_tree/status.rs
243

Do you mean to avoid calling matches when dirstate_node_state is None? It’s possible if matches the optimizer manages to prove matches side-effect-free, but I wouldn’t count on it. I’ll change the code.

359

Good catch. The sort was initially here. I moved it to a caller (because the other caller doesn’t need sorting) and failed to update the doc-comment.

baymax updated this revision to Diff 27623.May 6 2021, 12:03 PM

✅ refresh by Heptapod after a successful CI run (🐙 💚)

Alphare accepted this revision.May 6 2021, 12:09 PM
This revision is now accepted and ready to land.May 6 2021, 12:09 PM
SimonSapin marked an inline comment as done.May 6 2021, 12:54 PM
This revision was automatically updated to reflect the committed changes.