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

feat: set the default log rev to be the current stack #18

Merged
merged 1 commit into from
Sep 17, 2024
Merged
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
5 changes: 4 additions & 1 deletion doc/sapling-scm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ Sshow will run `sl show` command with the provided node id. This will put the
output in a new buffer with the commit description at the top in comments. The
buffer will have the file type of diff to give you the highlighting.

Slog {revset} *sapling-scm-slog*
Slog [revset] *sapling-scm-slog*

Run the log command and put the command output into a new buffer. You can
supply a revset that will be used to filter the log. For now this will use the
default output of the log command so the output template can be configured
with `ui.logtemplate` in your sapling config.

Running the log command with no revset will use the default revset of
`bottom::top` to focus the log to your current stack.

If you have `baleia.nvim` installed all the ANSI escape sequences will be
colorized in your output as they would in the terminal so you can keep your
output looking consistent.
Expand Down
8 changes: 8 additions & 0 deletions lua/sapling_scm_tests/fs_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ describe("Slog", function()
assert.matches("feat: support showing commits and logging", content)
end)
end)

describe("with no commits", function()
run_command "Slog"

it("uses the default range of the current stack", function()
assert.is_equal(vim.fn.expand "%", "sl://log/bottom::top")
end)
end)
end)

describe("Sshow", function()
Expand Down
4 changes: 2 additions & 2 deletions plugin/sapling_scm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ vim.api.nvim_create_user_command("Sshow", function(props)
end, { nargs = "+", desc = "Browse the current object on the remote url" })

vim.api.nvim_create_user_command("Slog", function(props)
vim.cmd("edit sl://log/" .. props.args)
end, { nargs = "+", desc = "Browse the current object on the remote url" })
vim.cmd("edit sl://log/" .. coalesce(props.args, "bottom::top"))
end, { nargs = "?", desc = "Browse the current object on the remote url" })

vim.api.nvim_create_user_command("Sdiff", function(props)
vim.cmd("edit sl://diff/" .. props.args)
Expand Down
Loading