This is an archive of the discontinued Mercurial Phabricator instance.

rust: Parse "subinclude"d files along the way, not later
ClosedPublic

Authored by SimonSapin on Jun 4 2021, 5:02 AM.

Details

Summary

When parsing a .hgignore file and encountering an include: line,
the included file is parsed recursively right then in a depth-first fashion.

With subinclude: however included files were parsed (recursively) much later.
This changes it to be expanded during parsing, like .hgignore.

The motivation for this is an upcoming changeset that needs to detect changes
in which files are ignored or not. The plan is to hash all ignore files while
they are being read, and store that hash in the dirstate (in v2 format).
In order to allow a potential alternative implementations to read that format,
the algorithm to compute that hash must be documented. Having a well-defined
depth-first ordering for the tree of (sub-)included files makes that easier.

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.Jun 4 2021, 5:02 AM
baymax updated this revision to Diff 28436.Jun 4 2021, 7:23 AM

โœ… refresh by Heptapod after a successful CI run (๐Ÿ™ ๐Ÿ’š)

Alphare accepted this revision as: Alphare.Jun 4 2021, 8:45 AM
Alphare added a subscriber: Alphare.

Note that I had the idea for this change and discussed it with Simon. I'm only accepting because the code looks right, but if another reviewer wants to approve it, that'd be great also.
As an aside, this also makes a potential hgignore crate easier to make.

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.