Repository navigation
Native Jujutsu (jj) support - #12
Open
CoreyKaylor wants to merge 4 commits into
Open
CoreyKaylor wants to merge 4 commits into
CoreyKaylor wants to merge 4 commits into
Conversation
bin/diffbandit gains repository-free subcommands so it can serve as jj's merge/diff editor and as a git mergetool/difftool: diffbandit merge BASE LEFT RIGHT OUTPUT [--path P] diffbandit edit LEFT RIGHT diffbandit diff LEFT RIGHT The merge host now takes a pluggable host (context, result path, resolve, after_resolve); the git host keeps the index-stage/`git add` behaviour and Merge.start_files uses a file host that writes OUTPUT on :w. Quitting a merge without resolving exits non-zero so the conflict is kept. Folder diffs get an editable-right mode for diff editors (right files are edited in place, missing ones are created on write, rows rescan on return) plus hide patterns for jj's JJ-INSTRUCTIONS file.
Consumers now require diffbandit.vcs instead of diffbandit.git. The proxy exposes the git module's function names and routes each call by its root/path/queue argument, so a second backend can plug in without touching the hosts, panel, or hunk actions. Only git is registered yet; vcs.prefer selects a backend once more exist. Also fixes git.current_branch (it called a local before its definition), drops a duplicate relpath, and stops commit_metadata from running a wasted `git log` when a revision is given. tests/run.lua accepts DIFFBANDIT_SPECS=20,50 to run a subset of specs.
In a jj workspace (colocated or not) the vcs proxy routes to the new jj backend, so reviews, hunk and file staging, the commit panel, log, compare, checkout, and conflict resolution all work there. Staging follows jj's squash workflow: an undescribed, mutable @- is the staging change, and staging moves hunks from @ into it with `jj diffedit --restore-descendants` (driven by a generated non-interactive tool script), so @'s content never changes. A described @- is treated as a commit: the first stage from the unstaged view starts a fresh staging change instead of rewriting it, and only amend mode stages into or re-describes it. Commit describes the staging change and opens a new one; without one it runs `jj commit`. The backend maps its views onto git-shaped options (unstaged @- -> @, staged @-- -> @-, all @-- -> @, rev for any revsets) so git/sources.lua builds diff sources unchanged; ref_labels and index_tracks_additions are the only jj hooks there. Conflicts in @ are read from git-style markers and resolved by writing the working copy through a jj merge host. CI installs a pinned jj; tests/specs/50_jj.lua runs against real jj repos (including `jj resolve` and `jj split` through bin/diffbandit) and is skipped when jj is missing.
README and :help diffbandit-jj describe how the views, staging, commit, amend, and conflicts map onto jj, the jj merge-tools configuration for using bin/diffbandit as jj's merge and diff editor, and current limits.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds native Jujutsu support (#11). In a jj workspace, review, staging, commit, log, compare and conflict resolution all run through jj, and diffbandit can act as jj's merge editor and diff editor.
This is open for jj users to try before it merges. Feedback on how the staging model feels is especially welcome.
Commits
diffbandit merge|edit|diff, a pluggable merge host, and an editable folder diff. It doesn't depend on jj and also works as a Git mergetool.50_jjspecs run against real jj repos. CI installs jj.:help diffbandit-jj.Trying it
Point your plugin manager at this branch, for example with lazy.nvim:
{ "CoreyKaylor/diffbandit.nvim", branch = "jj" }Then run
diffbandit(or:DiffBanditLaunch) in a jj repo. To use it as jj's editor too, add this to~/.config/jj/config.toml, withbin/diffbanditon your PATH:How staging maps to jj
@-→@, the same as plainjj diff.@into the staging change. The staging change is@-, as long as it has no description and can still be edited.@-is already a described commit, your first stage creates an empty staging change under@. An existing commit is never changed by accident.@-.:win the panel describes the staging change and opens a fresh one under@.Worth trying
jj split,jj squash -iandjj resolvewith the config above.vcs.prefer = "git"override.Known limits
jj resolve.@lists only its conflicts.Testing
50_jjspecs, andtests/integration/run.shpass on each commit.jj resolve(quitting keeps the conflict, saving resolves it),jj split, and staging from the panel.Closes #11