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

Support extending revset functionality with custom functions and programmatic filters #3618

Merged
merged 4 commits into from
May 6, 2024

Conversation

torquestomp
Copy link
Collaborator

This doesn't support everything an extension might want to do with the revset language, but it covers a large portion of it and for much less internal cost than the previous proposal.

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

@jonathantanmy
Copy link
Collaborator

Also is there a way to test the function and filter extensibility? I see that there is a CLI example that shows how to create a new filter, but that doesn't seem to cover the function ability, and does not seem to be exercised in a test.

@torquestomp
Copy link
Collaborator Author

Also is there a way to test the function and filter extensibility? I see that there is a CLI example that shows how to create a new filter, but that doesn't seem to cover the function ability, and does not seem to be exercised in a test.

Unfortunately I don't think there's currently a good way to set up tests for extension behavior; the low level revset_engine tests do not have enough context to produce a Store, and the high-level tests run jj directly which does not have extensions loaded in. Maybe we need some way to run example binaries instead of the main binary in tests

@torquestomp torquestomp force-pushed the dploch/filter-ext branch from 185693f to be65077 Compare May 3, 2024 23:45
Copy link
Collaborator

@yuja yuja left a comment

Choose a reason for hiding this comment

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

Looks generally good to me, thanks!

lib/src/revset.rs Outdated Show resolved Hide resolved
lib/src/revset.rs Outdated Show resolved Hide resolved
lib/src/revset.rs Outdated Show resolved Hide resolved
lib/src/revset.rs Outdated Show resolved Hide resolved
Cargo.lock Outdated Show resolved Hide resolved
lib/src/revset.rs Outdated Show resolved Hide resolved
lib/src/revset.rs Outdated Show resolved Hide resolved
@torquestomp torquestomp force-pushed the dploch/filter-ext branch from be65077 to b7ab068 Compare May 6, 2024 14:33
@torquestomp torquestomp enabled auto-merge (rebase) May 6, 2024 14:33
@torquestomp torquestomp merged commit 20af8c7 into main May 6, 2024
16 checks passed
@torquestomp torquestomp deleted the dploch/filter-ext branch May 6, 2024 14:42
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.

3 participants