Release (#313)
* Fix docs: choose_merge_request's open_reviewer default value is true (#316) * Fix: Only set autocommands for select popups (#315) * Docs: Small improvements to README and docs * Feat: Add branch info to choose_merge_request menu (#318) This is a PATCH release.
This commit is contained in:
committed by
GitHub
parent
96d7e16ef7
commit
3c9d95d25b
@@ -29,6 +29,9 @@ To view these help docs and to get more detailed help information, please run `:
|
|||||||
|
|
||||||
This will checkout the branch locally, and open the plugin's reviewer pane.
|
This will checkout the branch locally, and open the plugin's reviewer pane.
|
||||||
|
|
||||||
|
NOTE: At the moment, the plugin assumes that the remote where you want to merge your feature branch
|
||||||
|
is called "origin".
|
||||||
|
|
||||||
For more detailed information about the Lua APIs please run `:h gitlab.nvim.api`
|
For more detailed information about the Lua APIs please run `:h gitlab.nvim.api`
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ QUICK START *gitlab.nvim.quick-start*
|
|||||||
|
|
||||||
This will checkout the branch locally, and up the plugin's reviewer pane.
|
This will checkout the branch locally, and up the plugin's reviewer pane.
|
||||||
|
|
||||||
|
NOTE: At the moment, the plugin assumes that the remote where you want to
|
||||||
|
merge your feature branch is called "origin".
|
||||||
|
|
||||||
|
|
||||||
INSTALLATION *gitlab.nvim.installation*
|
INSTALLATION *gitlab.nvim.installation*
|
||||||
|
|
||||||
@@ -83,7 +86,7 @@ And with Packer:
|
|||||||
requires = {
|
requires = {
|
||||||
"MunifTanjim/nui.nvim",
|
"MunifTanjim/nui.nvim",
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
"sindrets/diffview.nvim"
|
"sindrets/diffview.nvim",
|
||||||
"stevearc/dressing.nvim", -- Recommended but not required. Better UI for pickers.
|
"stevearc/dressing.nvim", -- Recommended but not required. Better UI for pickers.
|
||||||
"nvim-tree/nvim-web-devicons", -- Recommended but not required. Icons in discussion tree.
|
"nvim-tree/nvim-web-devicons", -- Recommended but not required. Icons in discussion tree.
|
||||||
},
|
},
|
||||||
@@ -630,9 +633,10 @@ default arguments outlined under "Configuring the Plugin".
|
|||||||
*gitlab.nvim.choose_merge_request*
|
*gitlab.nvim.choose_merge_request*
|
||||||
gitlab.choose_merge_request({opts}) ~
|
gitlab.choose_merge_request({opts}) ~
|
||||||
|
|
||||||
Choose a merge request from a list of those open in your current project to review.
|
Choose a merge request from a list of those open in your current project to
|
||||||
This command will automatically check out that branch locally, and optionally
|
review. This command will automatically check out the feature branch locally,
|
||||||
open the reviewer pane. This is the default behavior.
|
and by default also open the reviewer pane (this can be overridden with the
|
||||||
|
`open_reviewer` parameter).
|
||||||
>lua
|
>lua
|
||||||
require("gitlab").choose_merge_request()
|
require("gitlab").choose_merge_request()
|
||||||
require("gitlab").choose_merge_request({ open_reviewer = false })
|
require("gitlab").choose_merge_request({ open_reviewer = false })
|
||||||
|
|||||||
@@ -316,8 +316,6 @@ M.create_mr = function()
|
|||||||
forked_project_id = forked_project_id,
|
forked_project_id = forked_project_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.print(body)
|
|
||||||
|
|
||||||
job.run_job("/create_mr", "POST", body, function(data)
|
job.run_job("/create_mr", "POST", body, function(data)
|
||||||
u.notify(data.message, vim.log.levels.INFO)
|
u.notify(data.message, vim.log.levels.INFO)
|
||||||
M.reset_state()
|
M.reset_state()
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ M.choose_merge_request = function(opts)
|
|||||||
vim.ui.select(state.MERGE_REQUESTS, {
|
vim.ui.select(state.MERGE_REQUESTS, {
|
||||||
prompt = "Choose Merge Request",
|
prompt = "Choose Merge Request",
|
||||||
format_item = function(mr)
|
format_item = function(mr)
|
||||||
return string.format("%s (%s)", mr.title, mr.author.name)
|
return string.format("%s [%s -> %s] (%s)", mr.title, mr.source_branch, mr.target_branch, mr.author.name)
|
||||||
end,
|
end,
|
||||||
}, function(choice)
|
}, function(choice)
|
||||||
if not choice then
|
if not choice then
|
||||||
|
|||||||
@@ -63,10 +63,20 @@ M.summary = function()
|
|||||||
description_popup,
|
description_popup,
|
||||||
M.edit_summary,
|
M.edit_summary,
|
||||||
miscellaneous.attach_file,
|
miscellaneous.attach_file,
|
||||||
{ cb = exit, action_before_close = true, save_to_temp_register = true }
|
{ cb = exit, action_before_close = true, action_before_exit = true, save_to_temp_register = true }
|
||||||
|
)
|
||||||
|
state.set_popup_keymaps(
|
||||||
|
title_popup,
|
||||||
|
M.edit_summary,
|
||||||
|
nil,
|
||||||
|
{ cb = exit, action_before_close = true, action_before_exit = true }
|
||||||
|
)
|
||||||
|
state.set_popup_keymaps(
|
||||||
|
info_popup,
|
||||||
|
M.edit_summary,
|
||||||
|
nil,
|
||||||
|
{ cb = exit, action_before_close = true, action_before_exit = true }
|
||||||
)
|
)
|
||||||
state.set_popup_keymaps(title_popup, M.edit_summary, nil, { cb = exit, action_before_close = true })
|
|
||||||
state.set_popup_keymaps(info_popup, M.edit_summary, nil, { cb = exit, action_before_close = true })
|
|
||||||
miscellaneous.set_cycle_popups_keymaps(popups)
|
miscellaneous.set_cycle_popups_keymaps(popups)
|
||||||
|
|
||||||
vim.api.nvim_set_current_buf(description_popup.bufnr)
|
vim.api.nvim_set_current_buf(description_popup.bufnr)
|
||||||
@@ -151,8 +161,6 @@ M.edit_summary = function()
|
|||||||
u.notify(data.message, vim.log.levels.INFO)
|
u.notify(data.message, vim.log.levels.INFO)
|
||||||
state.INFO.description = data.mr.description
|
state.INFO.description = data.mr.description
|
||||||
state.INFO.title = data.mr.title
|
state.INFO.title = data.mr.title
|
||||||
M.layout:unmount()
|
|
||||||
M.layout_visible = false
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -295,9 +295,9 @@ M.set_popup_keymaps = function(popup, action, linewise_action, opts)
|
|||||||
local text = u.get_buffer_text(popup.bufnr)
|
local text = u.get_buffer_text(popup.bufnr)
|
||||||
if opts.action_before_close then
|
if opts.action_before_close then
|
||||||
action(text, popup.bufnr)
|
action(text, popup.bufnr)
|
||||||
vim.api.nvim_buf_delete(popup.bufnr, {})
|
exit(popup, opts)
|
||||||
else
|
else
|
||||||
vim.api.nvim_buf_delete(popup.bufnr, {})
|
exit(popup, opts)
|
||||||
action(text, popup.bufnr)
|
action(text, popup.bufnr)
|
||||||
end
|
end
|
||||||
end, { buffer = popup.bufnr, desc = "Perform action" })
|
end, { buffer = popup.bufnr, desc = "Perform action" })
|
||||||
@@ -312,18 +312,26 @@ M.set_popup_keymaps = function(popup, action, linewise_action, opts)
|
|||||||
end, { buffer = popup.bufnr, desc = "Perform linewise action" })
|
end, { buffer = popup.bufnr, desc = "Perform linewise action" })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if opts.save_to_temp_register then
|
||||||
vim.api.nvim_create_autocmd("BufWinLeave", {
|
vim.api.nvim_create_autocmd("BufWinLeave", {
|
||||||
buffer = popup.bufnr,
|
buffer = popup.bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
if opts.save_to_temp_register then
|
|
||||||
local text = u.get_buffer_text(popup.bufnr)
|
local text = u.get_buffer_text(popup.bufnr)
|
||||||
for _, register in ipairs(M.settings.popup.temp_registers) do
|
for _, register in ipairs(M.settings.popup.temp_registers) do
|
||||||
vim.fn.setreg(register, text)
|
vim.fn.setreg(register, text)
|
||||||
end
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if opts.action_before_exit then
|
||||||
|
vim.api.nvim_create_autocmd("BufWinLeave", {
|
||||||
|
buffer = popup.bufnr,
|
||||||
|
callback = function()
|
||||||
exit(popup, opts)
|
exit(popup, opts)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Dependencies
|
-- Dependencies
|
||||||
|
|||||||
Reference in New Issue
Block a user