feat: list merge requests of current brnach

This commit is contained in:
Itai Bohadana
2026-03-23 15:51:23 +02:00
parent 4e0b24fd30
commit b2f6895557
5 changed files with 150 additions and 5 deletions

View File

@@ -325,7 +325,7 @@ M.set_global_keymaps = function()
if keymaps.global.choose_merge_request then
vim.keymap.set("n", keymaps.global.choose_merge_request, function()
require("gitlab").choose_merge_request()
require("gitlab").choose_merge_request_by_branch()
end, { desc = "Choose MR for review", nowait = keymaps.global.choose_merge_request_nowait })
end
@@ -568,6 +568,24 @@ M.dependencies = {
return opts
end,
},
merge_requests_by_branch = {
endpoint = "/merge_requests_by_branch",
key = "merge_requests",
state = "MERGE_REQUESTS",
refresh = true,
method = "POST",
body = function(opts)
if not opts then
opts = {}
end
local branch = require("gitlab.git").get_current_branch()
if branch == nil then
error("Invalid payload, branch could not be found!")
end
opts.branch = branch
return opts
end,
},
discussion_data = {
endpoint = "/mr/discussions/list",
state = "DISCUSSION_DATA",