Mercurial > hg
diff rust/hg-cpython/src/dirstate/status.rs @ 47379:f6bb181c75f8
rust: Parse "subinclude"d files along the way, not later
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.
Differential Revision: https://phab.mercurial-scm.org/D10834
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 02 Jun 2021 18:03:43 +0200 |
parents | 04d1f17f49e7 |
children | 269ff8978086 |
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/status.rs Wed Jun 02 18:14:44 2021 +0200 +++ b/rust/hg-cpython/src/dirstate/status.rs Wed Jun 02 18:03:43 2021 +0200 @@ -211,12 +211,9 @@ .collect(); let ignore_patterns = ignore_patterns?; - let mut all_warnings = vec![]; - let (matcher, warnings) = - IncludeMatcher::new(ignore_patterns, &root_dir) - .map_err(|e| handle_fallback(py, e.into()))?; - all_warnings.extend(warnings); + let matcher = IncludeMatcher::new(ignore_patterns) + .map_err(|e| handle_fallback(py, e.into()))?; let (status_res, warnings) = dmap .status( @@ -234,9 +231,7 @@ ) .map_err(|e| handle_fallback(py, e))?; - all_warnings.extend(warnings); - - build_response(py, status_res, all_warnings) + build_response(py, status_res, warnings) } e => Err(PyErr::new::<ValueError, _>( py,