Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fileset: add basic AST-level object and matcher builder #3467

Merged
merged 7 commits into from
Apr 6, 2024

Conversation

yuja
Copy link
Contributor

@yuja yuja commented Apr 6, 2024

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

Sorry, something went wrong.

yuja added 7 commits April 6, 2024 20:34
"Error" is super common type name, so I think better to not pollute the
namespace with a very specific Error type.
Since RepoPath is formatted as a string, it should be okay for RepoPathComponent
to do the same.
This helps to write snapshot tests.
…e output

The default Debug output entries aren't sorted by name, which was inconvenient
while writing snapshot tests.
FilesetExpression is similar to RevsetExpression, but there are two major
differences:
 - Union is represented as N-ary operator,
 - Expression node isn't Rc-ed.
The former is because of the nature of the runtime Matcher objects. It's easier
to construct a Matcher from flattened union expressions than from a binary tree.
The latter choice comes from UnionAll(Vec<FilesetExpression>), which doesn't
have to be Vec<Rc<FilesetExpression>>, and Rc<[FilesetExpression]> can't be
constructed from [Rc<_>, ..]. Anyway, the internal representation may change as
needed.

Another design decision I made is Vec<Pattern(RepoPathBuf)> vs
Pattern(Vec<RepoPathBuf>). I chose the former because it will be more closer
to the parsed tree of the fileset language.
Copy link
Member

@martinvonz martinvonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thank you!

@yuja yuja merged commit 47150d2 into jj-vcs:main Apr 6, 2024
16 checks passed
@yuja yuja deleted the push-xpqqyvrxwykt branch April 6, 2024 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants