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

FR: Allow exclusions in sparse checkouts #1896

Open
kamalmarhubi opened this issue Jul 22, 2023 · 4 comments
Open

FR: Allow exclusions in sparse checkouts #1896

kamalmarhubi opened this issue Jul 22, 2023 · 4 comments
Assignees
Labels
good first issue Good for newcomers polish🪒🐃 Make existing features more convenient and more consistent

Comments

@kamalmarhubi
Copy link

I'd like to be able to specify a few prefixes to exclude from my working copy.

Currently jj sparse set only allows positive patterns. To get what I want, I have to

  • jj sparse set --clear
  • jj sparse set --add everything except the patterns I want to exclude
  • continually repeat that previous step as new paths are introduced

It would be a lot more convenient to just be able to do something like jj sparse set --remove someprefix, or add some negated prefixes via jj sparse set --edit and have it work.

@kamalmarhubi
Copy link
Author

kamalmarhubi commented Jul 22, 2023

(Assuming we only care to allow prefix exclusions, and not arbitrary globs for an initial pass.)

Forgetting the interface aspects for now, it seems to me that something like is roughly the right path:

  • add a negated_prefixes to SparsePatterns
  • update TreeState::sparse_matcher to return an IntersectionMatcher(PrefixMathcher(prefixes), DifferenceMatcher(EverythingMatcher, PrefixMatcher(negated_prefixes)))

(Possibly adding a NegatedMatcher instead of using DifferenceMatcher in that way.)

@martinvonz
Copy link
Member

Yes, something like that sounds good.

  • update TreeState::sparse_matcher to return an IntersectionMatcher(PrefixMathcher(prefixes), DifferenceMatcher(EverythingMatcher, PrefixMatcher(negated_prefixes)))

Is that the same as DifferenceMatcher(PrefixMatcher(prefixes), PrefixMatcher(negated_prefixes))?

@kamalmarhubi
Copy link
Author

Is that the same as DifferenceMatcher(PrefixMatcher(prefixes), PrefixMatcher(negated_prefixes))?

yes, yes it is 🙈

@PhilipMetzger PhilipMetzger added the polish🪒🐃 Make existing features more convenient and more consistent label Aug 4, 2023
@martinvonz martinvonz added the good first issue Good for newcomers label Jan 21, 2024
@torquestomp torquestomp self-assigned this Jan 23, 2024
@torquestomp
Copy link
Contributor

I'm going to attempt to tackle this issue and issue #2288 simultaneously with a redesign of SparsePatterns from &[RepoPathBuf] into a structured format. I'll propose a design first

torquestomp added a commit that referenced this issue Jan 23, 2024
torquestomp added a commit that referenced this issue Jan 23, 2024
torquestomp added a commit that referenced this issue Jan 25, 2024
torquestomp added a commit that referenced this issue Jan 25, 2024
torquestomp added a commit that referenced this issue Jan 25, 2024
torquestomp added a commit that referenced this issue Jan 25, 2024
torquestomp added a commit that referenced this issue Jan 25, 2024
torquestomp added a commit that referenced this issue Jan 25, 2024
torquestomp added a commit that referenced this issue Jan 31, 2024
torquestomp added a commit that referenced this issue Feb 1, 2024
torquestomp added a commit that referenced this issue Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers polish🪒🐃 Make existing features more convenient and more consistent
Projects
None yet
Development

No branches or pull requests

4 participants