Commit 185173f9 authored by Christian Couder's avatar Christian Couder

Support adding and removing assignees w/ push opts

There are already push options for many things already, like
to add and remove labels from a merge request. See:

https://docs.gitlab.com/ee/user/project/push_options.html

But there is no push option yet to add and remove assignees
from a merge request. Let's implement that.
Signed-off-by: default avatarChristian Couder <christian@gitlab.com>
parent ad7c6878
...@@ -129,7 +129,9 @@ module MergeRequests ...@@ -129,7 +129,9 @@ module MergeRequests
target_branch: push_options[:target], target_branch: push_options[:target],
force_remove_source_branch: push_options[:remove_source_branch], force_remove_source_branch: push_options[:remove_source_branch],
label: push_options[:label], label: push_options[:label],
unlabel: push_options[:unlabel] unlabel: push_options[:unlabel],
assign: push_options[:assign],
unassign: push_options[:unassign]
} }
params.compact! params.compact!
......
---
title: Support adding and removing assignees w/ push opts
merge_request: 25904
author:
type: added
...@@ -68,6 +68,8 @@ time as pushing changes: ...@@ -68,6 +68,8 @@ time as pushing changes:
| `merge_request.description="<description>"` | Set the description of the merge request. Ex: `git push -o merge_request.description="The description I want"`. | [12.2](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/64320) | | `merge_request.description="<description>"` | Set the description of the merge request. Ex: `git push -o merge_request.description="The description I want"`. | [12.2](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/64320) |
| `merge_request.label="<label>"` | Add labels to the merge request. If the label does not exist, it will be created. For example, for two labels: `git push -o merge_request.label="label1" -o merge_request.label="label2"`. | [12.3](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/31831) | | `merge_request.label="<label>"` | Add labels to the merge request. If the label does not exist, it will be created. For example, for two labels: `git push -o merge_request.label="label1" -o merge_request.label="label2"`. | [12.3](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/31831) |
| `merge_request.unlabel="<label>"` | Remove labels from the merge request. For example, for two labels: `git push -o merge_request.unlabel="label1" -o merge_request.unlabel="label2"`. | [12.3](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/31831) | | `merge_request.unlabel="<label>"` | Remove labels from the merge request. For example, for two labels: `git push -o merge_request.unlabel="label1" -o merge_request.unlabel="label2"`. | [12.3](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/31831) |
| `merge_request.assign="<user>"` | Assign users to the merge request. For example, for two users: `git push -o merge_request.assign="user1" -o merge_request.assign="user2"`. | [12.9](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/XXXXX) |
| `merge_request.unassign="<user>"` | Remove assigned users from the merge request. For example, for two users: `git push -o merge_request.unassign="user1" -o merge_request.unassign="user2"`. | [12.9](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/XXXXX) |
If you use a push option that requires text with spaces in it, you need to enclose it If you use a push option that requires text with spaces in it, you need to enclose it
in quotes (`"`). You can omit the quotes if there are no spaces. Some examples: in quotes (`"`). You can omit the quotes if there are no spaces. Some examples:
......
...@@ -5,6 +5,7 @@ module Gitlab ...@@ -5,6 +5,7 @@ module Gitlab
VALID_OPTIONS = HashWithIndifferentAccess.new({ VALID_OPTIONS = HashWithIndifferentAccess.new({
merge_request: { merge_request: {
keys: [ keys: [
:assign,
:create, :create,
:description, :description,
:label, :label,
...@@ -12,6 +13,7 @@ module Gitlab ...@@ -12,6 +13,7 @@ module Gitlab
:remove_source_branch, :remove_source_branch,
:target, :target,
:title, :title,
:unassign,
:unlabel :unlabel
] ]
}, },
...@@ -23,7 +25,9 @@ module Gitlab ...@@ -23,7 +25,9 @@ module Gitlab
MULTI_VALUE_OPTIONS = [ MULTI_VALUE_OPTIONS = [
%w[ci variable], %w[ci variable],
%w[merge_request label], %w[merge_request label],
%w[merge_request unlabel] %w[merge_request unlabel],
%w[merge_request assign],
%w[merge_request unassign]
].freeze ].freeze
NAMESPACE_ALIASES = HashWithIndifferentAccess.new({ NAMESPACE_ALIASES = HashWithIndifferentAccess.new({
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment