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

Add jujutsu support #414

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ removed lines in a file that is managed by a version control system (VCS)._
---

- Supports **git**, **mercurial**, **darcs**, **bazaar**, **subversion**,
**cvs**, **rcs**, **fossil**, **accurev**, **perforce**, **tfs**, **yadm**.
**cvs**, **rcs**, **fossil**, **accurev**, **perforce**, **tfs**, **yadm**,
**jj**.
- **Asynchronous** execution of VCS tools for Vim 8.0.902+ and Neovim.
- **Preserves signs** from other plugins.
- Handles **nested repositories** controlled by different VCS.
Expand Down Expand Up @@ -46,6 +47,7 @@ endif
```

## Configuration for async update

```vim
" default updatetime 4000ms is not good for async update
set updatetime=100
Expand Down
9 changes: 8 additions & 1 deletion autoload/sy/repo.vim
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ function! s:check_diff_svn(exitval, diff) abort
return a:exitval ? [0, []] : [1, a:diff]
endfunction

" s:check_diff_jj {{{1
function! s:check_diff_jj(exitval, diff) abort
return a:exitval ? [0, []] : [1, a:diff]
endfunction

" s:check_diff_bzr {{{1
function! s:check_diff_bzr(exitval, diff) abort
return (a:exitval =~ '[012]') ? [1, a:diff] : [0, []]
Expand Down Expand Up @@ -629,7 +634,8 @@ let s:default_vcs_cmds = {
\ 'rcs': 'rcsdiff -U0 %f 2>%n',
\ 'accurev': 'accurev diff %f -- -U0',
\ 'perforce': 'p4 info '. sy#util#shell_redirect('%n') . (has('win32') ? ' &&' : ' && env P4DIFF= P4COLORS=') .' p4 diff -du0 %f',
\ 'tfs': 'tf diff -version:W -noprompt -format:Unified %f'
\ 'tfs': 'tf diff -version:W -noprompt -format:Unified %f',
\ 'jj': 'jj diff --color=never --git --context=0 -r @ -- %f',
\ }

let s:default_vcs_cmds_diffmode = {
Expand All @@ -645,6 +651,7 @@ let s:default_vcs_cmds_diffmode = {
\ 'accurev': 'accurev cat %f',
\ 'perforce': 'p4 print %f',
\ 'tfs': 'tf view -version:W -noprompt %f',
\ 'jj': 'jj cat -- %f',
Copy link

Choose a reason for hiding this comment

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

Shouldn't this be getting the file contents from @- (ie, jj cat -r @- -- %f)?

The jj diff in default_vcs_commands shows the diff between @- and @, and practically speaking, @- is jj's HEAD analogue.

It's more complicated if @ is a merge, since that would involve synthesising a merged version of the parents' files like jj diff does. I don't have a good solution for that, unfortunately.

Copy link

@algmyr algmyr Jan 20, 2025

Choose a reason for hiding this comment

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

That sounds like it might be what we want yeah. Tbh I'm still not sure exactly sure what signify uses the different commands for.

Some quick testing: With the current setup it seems to default to show the diff compared to @-,but with edits to the buffer it shows the diff compared to @. Tbh, I don't hate that behavior but I suspect it's not what is expected compared to the other vcs implementations here. With -r @- it behaves more like you would expect. So +1 to fixing that

Copy link

Choose a reason for hiding this comment

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

Also, jj cat is deprecated, jj file show would be the new spelling.

\ }

if exists('g:signify_vcs_cmds')
Expand Down
5 changes: 4 additions & 1 deletion doc/signify.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ The key can be any from this list:
accurev
perforce
tfs
jj

Modifiers:~

Expand Down Expand Up @@ -201,7 +202,8 @@ Default:
\ 'rcs': 'rcsdiff -U0 %f 2>%n',
\ 'accurev': 'accurev diff %f -- -U0',
\ 'perforce': 'p4 info '. sy#util#shell_redirect('%n') . (has('win32') ? ' &&' : ' && env P4DIFF= P4COLORS=') .' p4 diff -du0 %f',
\ 'tfs': 'tf diff -version:W -noprompt -format:Unified %f'
\ 'tfs': 'tf diff -version:W -noprompt -format:Unified %f',
\ 'jj': 'jj diff --color=never --context=0 -r @ -- %f',
\ }
<
------------------------------------------------------------------------------
Expand All @@ -219,6 +221,7 @@ Default:
\ 'accurev': 'accurev cat %f',
\ 'perforce': 'p4 print %f',
\ 'tfs': 'tf view -version:W -noprompt %f',
\ 'jj': 'jj cat -- %f',
\ }
<
The command to use for updating signs in a `modified` buffer, thus when the
Expand Down