This is an archive of the discontinued Mercurial Phabricator instance.

dirstate-tree: Add `WithBasename` wrapper for `HgPath`
ClosedPublic

Authored by SimonSapin on Apr 12 2021, 8:23 AM.

Details

Summary

In the tree-shaped dirstate we want to have nodes representing files or
directories, where directory nodes contain a map associating "base" names
to child nodes for child files and directories.

Many dirstate operations expect a full path from the repository root, but
re-concatenating string from nested map keys all the time might be expensive.
Instead, WithBasename stores a full path for these operations but
behaves as its base name (last path component) for equality and comparison.

Additionally inclusive_ancestors provides the successive map keys
that are needed when inserting a new dirstate node at a given full path.

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.Apr 12 2021, 8:23 AM
baymax updated this revision to Diff 27049.Apr 19 2021, 11:02 AM

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

Alphare accepted this revision.Apr 19 2021, 11:36 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.