Fix MR Selection, Go Code Refactor (#358)

refactor: Refactors the Go codebase into a more modular and idiomatic approach
fix: require selection of specific MR when there are multiple targets for a given source branch
feat: Allows for the passing of Gitlab's filter options when choosing an MR, improves MR selection
feat: API to choose an MR from a list based on the provided username's involvement as an assignee/reviewer/author

This is a #MINOR release
This commit is contained in:
Harrison (Harry) Cramer
2024-09-08 16:45:09 -04:00
committed by GitHub
parent 6500ef1f2c
commit ea2b2b2f5c
81 changed files with 2559 additions and 3035 deletions

View File

@@ -739,22 +739,39 @@ Choose a merge request from a list of those open in your current project to
review. This command will automatically check out the feature branch locally
and open the reviewer pane (this can be overridden with the `open_reviewer`
parameter.
You can also filter merge requests by specifying `label` and `notlabel`
parameters.
parameters, or any other parameter included in list MRs API.
By default, the endpoint will return all open merge requests.
>lua
require("gitlab").choose_merge_request()
require("gitlab").choose_merge_request({ open_reviewer = false })
require("gitlab").choose_merge_request({ label = {"include_mrs_with_label"} })
require("gitlab").choose_merge_request({ notlabel = {"exclude_mrs_with_label"} })
require("gitlab").choose_merge_request({ labels = {"include_mrs_with_label"} })
require("gitlab").choose_merge_request({ ["[not]labels"] = {"exclude_mrs_with_label"} })
<
Parameters: ~
• {opts}: (table|nil) Keyword arguments to configure the checkout.
• {opts}: (table|nil)
• {open_reviewer}: (boolean) Whether to open the reviewer after
switching branches. True by default.
• {label}: (table<string>) Return merge requests with *including* matching labels
{notlabel}: (table<string>) Return merge requests *excluding*
matching label
• {labels}: (table<string>) Return merge requests with *including* matching labels
Etc, see: https://docs.gitlab.com/ee/api/merge_requests.html#list-merge-requests
*gitlab.nvim.choose_merge_request*
gitlab.choose_merge_request_by_username({opts}) ~
Choose a merge request based on the username provided. Like the `choose_merge_request`
action, this will automatically check out the branch locally and open the
the reviewer pane when the MR is chosen.
>lua
require("gitlab").choose_merge_request_by_username({ username = "hcramer" })
<
Parameters: ~
• {opts}: (table|nil)
• {username}: (string) The username of the Gitlab user, must be a
member of the current project.
• {state} [optional]: (string) The status of the MR, e.g. "opened" or "all"
*gitlab.nvim.review*
gitlab.review() ~