feat: vcs: support Jujutsu as a diff-provider - #12022
Conversation
d07b9ff to
601e3a5
Compare
422e761 to
fc7c8d1
Compare
fc7c8d1 to
3bb3fb5
Compare
3bb3fb5 to
35f2ee1
Compare
|
Hi @poliorcetics, Thanks for this PR, hope it will be merged soon. |
35f2ee1 to
4daf973
Compare
|
Hi @poliorcetics, Thank you for working on integrating jj into helix, I am using helix from your branch, and it has been great so far. I am new to jj, and this PR is still a draft, but wanted to make a suggestion on the status-line entry, Will |
4daf973 to
c508dd1
Compare
It could easily be done code-wise, but I'm trying to get the same behavior as the If maintainers confirm it would be ok to add, I'll do it :) |
|
This gets a bit weird with reloading newly-added or untracked files.
Each time the file is reloaded, the diff base is set to the current file. I have somewhat of a fix for this at d4a0e44. If the file is untracked, return early. If the file is new, return an empty base. Otherwise, continue as before. I'm not really a fan of my implementation, since it relies on jj emitting a warning message if the file isn't found in the repo. Could do without that by doing a separate |
|
Was curious to see what an implementation using |
da5d835 to
035ccd0
Compare
035ccd0 to
b58879e
Compare
b58879e to
8b10cc2
Compare
8b10cc2 to
5e0f205
Compare
5e0f205 to
30dd7e2
Compare
30dd7e2 to
ec98a74
Compare
|
Looks like this feature doesn't always work. I experienced this on a non-collocated repo as well as (albeit less often) on pure Git repos. |
ec98a74 to
ee0e561
Compare
ee0e561 to
f597775
Compare
|
I'm not getting any gutter information in a pure JJ repo, and there aren't any logs to suggest something went wrong. Does this PR not provide gutter information? If not could we? I'd be happy to hack on this and see if I can get it going |
It worked intermittently for me as well. I suspect it hits some threshold timeout in case the repo is large enough. |
8ccbcdc to
6e20c16
Compare
6e20c16 to
7798fd4
Compare
7798fd4 to
061d666
Compare
|
A small suggestion, to avoid duplicated entries in the change picker in case of conflict: diff --git a/helix-vcs/src/jj.rs b/helix-vcs/src/jj.rs
index ab0799cdc1..711652dade 100644
--- a/helix-vcs/src/jj.rs
+++ b/helix-vcs/src/jj.rs
@@ -5,6 +5,7 @@
//! Instead in case there *is* a diff to base ourselves on, we copy it to a tempfile or just use the
//! current file if not.
+use std::collections::HashSet;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::sync::Arc;
@@ -178,12 +179,14 @@
anyhow::ensure!(out.status.success(), "`jj file list` executed but failed");
+ let mut conflicted = HashSet::new();
for entry in split_double_slash(&out.stdout, true) {
if entry.is_empty() {
continue;
}
let path = make_pathbuf(entry);
+ conflicted.insert(path.clone());
if !callback(Ok(FileChange::Conflict { path })) {
return Ok(());
@@ -257,6 +260,11 @@
continue;
};
+ // Skip files already reported as conflicted above
+ if conflicted.contains(change.path()) {
+ continue;
+ }
+
if !callback(Ok(change)) {
return Ok(());
} |
061d666 to
01639ea
Compare
01639ea to
4751c16
Compare
d070a50 to
47bccec
Compare
47bccec to
ccca02d
Compare
ccca02d to
e985bd0
Compare
|
Recent changes:
|
900399d to
af215b3
Compare
Clippy says it's currently 784 bytes. Given it's intended to be long lived, allocating to fix that is not an issue.
af215b3 to
7936b95
Compare
b99c20b to
ddfb07e
Compare
|
Previously if you reloaded a newly added file, the gutter diff would start being computed from the file on disk, that is not mark the entire file as "added" but sections as "modified" in the gutter. This is now fixed :) |
e3fb7dc to
397e595
Compare
|
Fixed a bug with JJ 0.44.0 This is not the first failure I see like this in Github actions, I saw it in other repos too, I don't think this is something I can fix |
397e595 to
1c8811a
Compare


Built on top of #9951, I'll be waiting for it to be merged to un-draft this
Jujutsu (
jj) is a new change-based VCS (whereasgitis branch-based).In this PR, I add the ability for helix to get the diffs and current head, behind a feature called
jjthat is active by default. That would make it the first editor I know off that officially handles 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-libbut it's not ready for use in third party programs and wouldn't fix the issue of custom backends anyway.Testing
Since testing needs
jjinstalled, I haven't written any for Helix yet to discuss how to do it:jjin CI and use it to test the new feature