feat: Rebase on log buffer (#62)

Now it is possible to rebase interactively from the log buffer with visual feedback. You can rebase one or many visually selected changes.

Supported target modes are: `-o` / `-A` / `-B`.

Limitation:
	- As of now you cannot rebase a whole branch (-b) from the log view.

Bonus from this pr:
	- Now keymaps support different modes
This commit is contained in:
Nicolas GB
2026-01-02 18:41:59 +01:00
committed by GitHub
parent 2c898c6be3
commit 12e91e547d
8 changed files with 546 additions and 78 deletions
+16 -1
View File
@@ -112,7 +112,7 @@ end
--- Extract revision ID from a jujutsu log line
--- @param line string The log line to parse
--- @return string|nil The revision ID if found, nil otherwise
function M.get_rev_from_log_line(line)
function M.get_revset(line)
-- Build pattern to match graph characters and symbols at start of line
-- Include: box-drawing chars, whitespace, jujutsu UTF-8 symbols, and ASCII markers
local graph_chars = "│┃┆┇┊┋╭╮╰╯├┤┬┴┼─└┘┌┐%s" -- box-drawing + whitespace
@@ -147,6 +147,21 @@ function M.get_rev_from_log_line(line)
return revset
end
--- Given a string with N lines find all revsets in them
--- @param lines string[] An array of lines to parse
--- @return string[]|nil An array of revsets found, or nil if none found
function M.get_all_revsets(lines)
local revsets = {}
for _, line in pairs(lines) do
local revset = M.get_revset(line)
if revset then
table.insert(revsets, revset)
end
end
return #revsets > 0 and revsets or nil
end
--- Given an annotation line, parses and returns its components with positions
--- @param line string The annotation line to parse
--- @return table A table with {rev = {value = string|nil, pos = {start, end}|nil}, name = {value = string|nil, pos = {start, end}|nil}, date = {value = string|nil, pos = {start, end}|nil}}