Skip to content

Add support for jujutsu#160

Merged
junglerobba merged 1 commit intojrmoulton:mainfrom
junglerobba:jj
Jun 2, 2025
Merged

Add support for jujutsu#160
junglerobba merged 1 commit intojrmoulton:mainfrom
junglerobba:jj

Conversation

@junglerobba
Copy link
Collaborator

#124

builds on top of #159

uses jj-lib crate

This adds a config option vcs_providers, where both git and jj
can be added. By default only git is enabled.
Providers are used lazily in order, so if jujutsu is configured before git,
git will not find a colocated jj repository if jj found it first.

Worktrees/workspaces are handled differently depending on vcs provider.
Git should behave the same as before, with the exception that on non-bare
repos worktrees will be opened as new windows as well.
jj doesn't have bare repos, and so far there doesn't seem to be a reliable
way to refer from the "base" repo to its workspaces, so instead tms will
scan all configured search paths for workspaces belonging to the base
workspace that is opened, and then open a new window for each of them.
(jj workspaces are identified by .jj/repo not being the actual repo,
but instead a file that points to the main workspace where the repo is
stored)

I haven't used this a lot for actual work yet, I will do that for the coming
days starting next week to see if this causes any issues. Otherwise I'd appreciate
if others who are interested could test as well :)

( @mrcjkb ? )

@jrmoulton
Copy link
Owner

Ooh exciting. I'll make time to review these on Saturday

@mrcjkb
Copy link
Contributor

mrcjkb commented Apr 3, 2025

Wow, this is awesome!
I'm adding it to my NixOS config now 😄

src/repos.rs Outdated
Comment on lines +90 to +98
let user_settings = UserSettings::from_config(StackedConfig::with_defaults())
.change_context(TmsError::GitError)?;
let mut store_factories = StoreFactories::default();
store_factories.add_backend(
GitBackend::name(),
Box::new(|settings, store_path| {
Ok(Box::new(GitBackend::load(settings, store_path)?))
}),
);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This part I'm a bit uncertain about. Do we care about user settings in order to load a repo?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure we care currently, but there's always the future and as far as I know gix loads the user settings before trying to load a repo as well

@jrmoulton
Copy link
Owner

sorry still haven't gotten around to reviewing this. I'll be graduating in a few weeks and will definitely have more time then

uses jj-lib crate

This adds a config option `vcs_providers`, where both `git` and `jj`
can be added. By default only git is enabled.
Providers are used lazily in order, so if jujutsu is configured before git,
git will not find a colocated jj repository if jj found it first.

Worktrees/workspaces are handled differently depending on vcs provider.
Git should behave the same as before, with the exception that on non-bare
repos worktrees will be opened as new windows as well.
jj doesn't have bare repos, and so far there doesn't seem to be a reliable
way to refer from the "base" repo to its workspaces, so instead tms will
scan all configured search paths for workspaces belonging to the base
workspace that is opened, and then open a new window for each of them.
(jj workspaces are identified by `.jj/repo` not being the actual repo,
but instead a file that points to the main workspace where the repo is
stored)
Copy link
Owner

@jrmoulton jrmoulton left a comment

Choose a reason for hiding this comment

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

LGTM!

Sorry this took so long to review

@junglerobba junglerobba merged commit ff6e289 into jrmoulton:main Jun 2, 2025
6 checks passed
@junglerobba junglerobba deleted the jj branch June 4, 2025 20:58
@junglerobba junglerobba mentioned this pull request Jun 25, 2025
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.

4 participants