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

feat: Add Jujutsu diff handling to Helix #9643

Closed

Conversation

poliorcetics
Copy link
Contributor

@poliorcetics poliorcetics commented Feb 16, 2024

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:

  1. 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
  2. Install jj in CI and use it to test the new feature

helix-term/src/main.rs Outdated Show resolved Hide resolved
@the-mikedavis the-mikedavis added S-waiting-on-review Status: Awaiting review from a maintainer. A-vcs Area: Version control system interaction labels Feb 17, 2024
@poliorcetics poliorcetics force-pushed the ab/push-qlnzrvuzokww branch 5 times, most recently from 8ec63b8 to 97f67d5 Compare February 20, 2024 07:37
@maan2003
Copy link

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

@poliorcetics
Copy link
Contributor Author

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

@ocharles
Copy link
Contributor

Am I right in understanding this lets us navigate between changes in jj repositories that aren't colocated with a Git repository

@poliorcetics poliorcetics force-pushed the ab/push-qlnzrvuzokww branch 3 times, most recently from b1477aa to b9eaa72 Compare March 6, 2024 09:56
@poliorcetics poliorcetics force-pushed the ab/push-qlnzrvuzokww branch 6 times, most recently from b167c2b to 3483dbb Compare March 15, 2024 16:11
@poliorcetics poliorcetics force-pushed the ab/push-qlnzrvuzokww branch 7 times, most recently from e36fdad to 1a03328 Compare March 25, 2024 20:19
@poliorcetics poliorcetics force-pushed the ab/push-qlnzrvuzokww branch 3 times, most recently from 7b34de9 to 0ea496e Compare April 10, 2024 18:26
@poliorcetics poliorcetics force-pushed the ab/push-qlnzrvuzokww branch 3 times, most recently from d822a91 to f4b6053 Compare May 3, 2024 18:05
@poliorcetics poliorcetics force-pushed the ab/push-qlnzrvuzokww branch 2 times, most recently from 0c078a4 to c0753ab Compare June 2, 2024 21:26
@poliorcetics poliorcetics force-pushed the ab/push-qlnzrvuzokww branch 2 times, most recently from a4c5507 to ccf068c Compare July 16, 2024 19:12
@mjm
Copy link
Contributor

mjm commented Jul 17, 2024

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.

@poliorcetics
Copy link
Contributor Author

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 #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 :)

@poliorcetics poliorcetics deleted the ab/push-qlnzrvuzokww branch October 19, 2024 11:21
@ShaddyDC
Copy link

May I ask why this was closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vcs Area: Version control system interaction S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants