feat(split): add jj split command with interactive floating terminal

Add split command that allows splitting a change into multiple revisions
    from the log buffer or via :J split. Supports --parallel, --message,
    --fileset, and --ignore-immutable flags. Includes immutability checks
    with user confirmation and empty change detection.
This commit is contained in:
NicolasGB
2026-02-13 18:44:27 +01:00
committed by Nicolas GB
parent 3115a0b3f0
commit 3d78c28f7e
6 changed files with 325 additions and 44 deletions
+25
View File
@@ -725,6 +725,26 @@ function M.handle_log_quick_squash()
end, string.format("Error squashing `%s` into it's parent", revset))
end
--- Handle log split
function M.handle_log_split()
local revset = get_revset()
if not revset or revset == "" then
return
end
require("jj.cmd").split({
rev = revset,
on_exit = function(exit_code)
if exit_code == 0 then
utils.notify(string.format("Successfully split `%s`", revset), vim.log.levels.INFO)
M.log({})
else
utils.notify(string.format("Cancelled splitting `%s`", revset), vim.log.levels.WARN)
end
end,
})
end
--- Handle diff action in summary tooltip
--- Diffs the file at revset against its parent (revset-)
--- Opens a floating diff, and returns focus to tooltip when closed
@@ -1007,6 +1027,11 @@ function M.log_keymaps()
handler = M.handle_log_summary,
modes = { "n" },
},
split = {
desc = "Split the revision under cursor",
handler = M.handle_log_split,
modes = { "n" },
},
}
return cmd.merge_keymaps(cmd.resolve_keymaps_from_specs(keymaps, specs), cmd.terminal_keymaps())