mirror of
https://github.com/zoriya/jj.nvim.git
synced 2026-08-15 23:53:18 +00:00
feat(diff): Add the diff_history command (#97)
This new command is natively implemented by both the `codediff` and `diffview` backends allowing to easily navigate the changes between two revsets while diffing the. It also gives a new `:J diff_hisotyr` command that optionally takes a range of revsets formatted `<rev1>..<rev2>` otherwise it prompts the user for the range.
This commit is contained in:
@@ -229,4 +229,20 @@ function M.parse_annotation_line(line)
|
||||
return result
|
||||
end
|
||||
|
||||
-- Given a range with the format "left..right", parse and return the two revisions
|
||||
--- @param range_str string The range string to parse (e.g., "left..right")
|
||||
--- @return {left: string, right: string}|nil A table
|
||||
function M.parse_diff_range(range_str)
|
||||
if not range_str then
|
||||
return nil
|
||||
end
|
||||
|
||||
local left, right = range_str:match("^(%S+)%.%.(%S+)$")
|
||||
if left and right then
|
||||
return { left = left, right = right }
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user