Spencer Baugh <sbaugh@janestreet.com> [Wed, 02 Aug 2023 10:46:47 -0400] rev 50866
rhg: support "status FILE"
This change adds a new [file] argument to rhg status, parses them as
patterns, canonicalizes the paths, and constructs a new PatternMatcher
to intersect with the existing matcher being passed to the status
implementation.
We also make filepatterns a public module so we can access the
pattern-parsing functionality we need from commands/status.rs.
Spencer Baugh <sbaugh@janestreet.com> [Wed, 02 Aug 2023 10:16:33 -0400] rev 50865
rust-matchers: add PatternMatcher
This should match the behavior of the Python patternmatcher. We need
this for status [FILES] support.
Spencer Baugh <sbaugh@janestreet.com> [Wed, 02 Aug 2023 10:33:11 -0400] rev 50864
rust-status: only visit parts of the tree requested by the matcher
This is an optimization that the matcher is designed to support, but
we weren't doing it until now. This is primarily relevant for
supporting "hg status [FILES]", where this optimization is crucial for
getting good performance (without this optimization, that command will
still scan the entire tree, and just filter it down after the fact).
When this optimization fires we have to return false from
traverse_fs_directory_and_dirstate, representing that that part of the
tree *might* have new files which we didn't see because we skipped
parts of it. This only affects the cached result of the status, and
is necessary to make future status operations (which might use a
different matcher) work properly.
Spencer Baugh <sbaugh@janestreet.com> [Wed, 02 Aug 2023 10:21:18 -0400] rev 50863
rust-status: error on non-existent files in file_set
file_set here consists of the files that were explicitly specified on
the command line. Erroring on them matches the behavior of Python
status.
Spencer Baugh <sbaugh@janestreet.com> [Wed, 02 Aug 2023 10:07:00 -0400] rev 50862
rust-status: explicitly track bad file types
Before this, we silently skipped bad file types.
Now, we check to see if a path is an exact_match in our matcher, and
if so, print an error for it, and only then do we skip it.
A path will be an exact match when it's specified as an explicit
command line argument, and this error-printing behavior is necessary
for compatibility with Python status.
Spencer Baugh <sbaugh@janestreet.com> [Mon, 14 Aug 2023 09:25:36 -0400] rev 50861
rust: de-hardcode glob_suffix
We're adding patternmatcher in a subsequent commit, and this needs
needs to be different for includematcher and patternmatcher.
Spencer Baugh <sbaugh@janestreet.com> [Tue, 08 Aug 2023 11:50:26 -0400] rev 50860
rust: improve the type on DirsMultiset::from_manifest
It could only return an HgPathError, but we didn't express this in the
type, so we needed some unreachable!()s. Now that is expressed in the
type.
Spencer Baugh <sbaugh@janestreet.com> [Wed, 02 Aug 2023 09:59:49 -0400] rev 50859
rust: don't escape spaces in regex
Spaces are not in fact a regex special character, and escaping them is
not correct.
Spencer Baugh <sbaugh@janestreet.com> [Wed, 02 Aug 2023 10:09:23 -0400] rev 50858
rust-filepatterns: also normalize RelPath
These patterns should be normalized too; this at least does no harm,
and is necessary for proper status support.
Spencer Baugh <sbaugh@janestreet.com> [Wed, 09 Aug 2023 18:08:28 -0400] rev 50857
rust: simplify pattern file parsing
Previously we kept the pattern syntax as a &[u8] until the last
possible moment, which meant we had to handle potential errors when
parsing that &[u8]. But such errors could never actually occur, given
the structure of the code.
Now we parse it eagerly (in two places) and pass it around as a
PatternSyntax, so we can delete some error handling code.
parse_one_pattern is in particular useful for parsing patterns passed
on the command line, as we'll support later in this series.