helix
helix copied to clipboard
feat: Add Jujutsu diff handling to Helix
Jujutsu (jj) is a new change-based VCS (whereas git is branch-based).
In this PR, I add the ability for helix to get the diffs and current head, behind a feature called jujutsu that is active by default. That makes it the first editor I know off that handles such that VCS!
To handle all current, future and private backends (Google already has one I believe), I instead made it so Helix can behave as a diff tool for Jujutsu and then use that as a subcommand to get the diff base.
For the head, I simply used the templating system to extract all relevant informations.
Jujutsu has a library, called jj-lib but it's not ready for use in third party programs and wouldn't fix the issue of custom backends anyway.
Testing
Since testing needs jj installed, I haven't written any for Helix yet to discuss how to do it:
- Ignore the issue. I don't like it much, but it doesn't cost CI time and doesn't need any change. For a feature that probably won't be used much yet, that's probably ok for a time
- Install
jjin CI and use it to test the new feature
would be cool to automatically run some jj command every save, so jj records the working copy. then we can run jj undo to revert a save
I like the idea, but probably for another MR ? It's more involved and would need some configuration changes to ensure people not using jj are not paying the cost on each save
A more general "run X on save" could be very nice.
Note: jj already supports watchman (https://martinvonz.github.io/jj/v0.14.0/config/#watchman), you can use that instead for now
Am I right in understanding this lets us navigate between changes in jj repositories that aren't colocated with a Git repository
It would be nice if the Jujutsu provider was tried before Git, so that it was used instead of Git when using a colocated repository. Right now, I find the Jujutsu provider is only used for non-colocated repos.
It would be nice if the Jujutsu provider was tried before Git, so that it was used instead of Git when using a colocated repository. Right now, I find the Jujutsu provider is only used for non-colocated repos.
IMO no, at least no by default, the idea being people not using JJ shouldn't be paying the cost for it on each opened file.
I have https://github.com/helix-editor/helix/pull/9951 open instead and the plan is to make the diff source discovery order configurable, so that people using JJ can put it first without impacting anyone else :)