更新合并请求
功能介绍
更新合并请求
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
URI
PUT /v4/repositories/{repository_id}/merge-requests/{merge_request_iid}
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
repository_id |
是 |
Integer |
参数解释: 仓库的ID,通过查询用户所有仓库接口查询项目列表获取。 约束限制: 不涉及。 取值范围: 1-2147483647 |
merge_request_iid |
是 |
Integer |
参数解释: 合并请求 iid。 取值范围: 1-2147483647 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
参数解释: 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 约束限制: 必传。 取值范围: 字符串长度不少于1,不超过10万。 默认取值: 不涉及。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
title |
否 |
String |
合并请求标题 |
state_event |
否 |
String |
合并请求状态 枚举值:
|
assignee_ids |
否 |
String |
合并人id列表 |
reviewer_ids |
否 |
String |
评审人id列表 |
description |
否 |
String |
合并请求描述 |
milestone_id |
否 |
Integer |
里程碑id |
labels |
否 |
Object |
标签 |
force_remove_source_branch |
否 |
Boolean |
合入后删除源分支 |
squash |
否 |
Boolean |
squash合入 |
squash_commit_message |
否 |
String |
squash提交信息 |
work_item_ids |
否 |
Array of strings |
e2e单号 |
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
id |
Integer |
合并请求id |
iid |
Integer |
合并请求iid |
repository_id |
Integer |
目标仓库id |
title |
String |
合并请求标题 |
description |
String |
合并请求描述 |
state |
String |
合并请求状态 |
created_at |
String |
创建时间 |
updated_at |
String |
更新时间 |
source_branch |
String |
源分支 |
target_branch |
String |
目标分支 |
is_source_branch_protected |
Boolean |
源分支是否为保护分支 |
devcloud_source_branch |
String |
源分支 |
author |
UserBasicExternalDto object |
作者 |
source_repository_id |
Integer |
源仓库id |
target_repository_id |
Integer |
目标仓库id |
source_project_id |
String |
源项目id |
target_project_id |
String |
目标项目id |
labels |
Array of objects |
标签 |
work_in_progress |
Boolean |
WIP状态 |
milestone |
MilestoneBasicDto object |
里程碑 |
merge_when_build_succeeds |
Boolean |
流水线成功后自动合入 |
merge_status |
String |
可合并状态 |
sha |
String |
当前合并请求最新commit |
merge_commit_sha |
String |
合入commit节点 |
subscribed |
Boolean |
订阅 |
merged_by |
UserBasicExternalDto object |
合并人 |
merged_at |
String |
合并时间 |
closed_by |
UserBasicExternalDto object |
关闭人 |
closed_at |
String |
关闭时间 |
user_notes_count |
Integer |
检视意见数量 |
force_remove_source_branch |
Boolean |
合入后删除源分支 |
web_url |
String |
主页url |
merge_request_diff |
MergeRequestDiffExternalDto object |
合并请求diff |
merge_request_reviewers_count |
Integer |
评审人数量 |
merge_request_review_count |
Integer |
打分 |
merge_request_reviewer_list |
Array of MergeRequestReviewerExternalDto objects |
评审人列表 |
merge_request_assignee_list |
Array of UserBasicExternalDto objects |
合并人列表 |
notes |
Integer |
检视意见 |
codecheck_state |
Integer |
代码检查状态 |
codecheck_defect_count |
Integer |
代码检查问题数 |
merge_request_related_work_items |
Array of MergeRequestRelatedWorkItemDto objects |
合并请求关联单数量 |
diverged_commits_count |
Integer |
源分支落后commit数 |
moderation_result |
Boolean |
送审结果 |
moderation_time |
Long |
送审时间时间戳 取值范围: 1-9223372036854775807 |
moderation_status |
Integer |
送审状态码 取值范围: 1-2147483647 |
is_use_temp_branch |
Boolean |
是否使用临时分支 |
approval_merge_request_approvers |
Array of ApprovalUserDto objects |
审核人 |
review_mode |
String |
合并请求模式 枚举值:
|
squash |
Boolean |
squash合入 |
squash_commit_message |
String |
squash提交信息 |
rebase_in_progress |
Boolean |
是否正在rebase |
source_repository |
ProjectSimpleDto object |
源仓库 |
target_repository |
ProjectSimpleDto object |
目标仓库 |
is_source_branch_exist |
Boolean |
源分支是否存在 |
merge_request_type |
String |
合并请求类型 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
Integer |
里程碑id 取值范围: 1-2147483647 |
iid |
Integer |
里程碑iid 取值范围: 1-2147483647 |
repository_id |
Integer |
仓库id 取值范围: 1-2147483647 |
title |
String |
里程碑标题 |
description |
String |
里程碑描述 |
state |
String |
状态 |
created_at |
String |
创建时间 |
updated_at |
String |
更新时间 |
due_date |
String |
到期时间 |
start_date |
String |
开始时间 |
repository_path |
String |
仓库路径 |
web_url |
String |
主页url |
参数 |
参数类型 |
描述 |
---|---|---|
id |
Integer |
用户id 取值范围: 1-2147483647 |
name |
String |
名称 |
username |
String |
用户名称 |
state |
String |
状态 |
avatar_url |
String |
头像url |
web_url |
String |
主页url |
nick_name |
String |
用户昵称 |
tenant_name |
String |
租户名称 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
Integer |
合并请求diff id 取值范围: 1-2147483647 |
state |
String |
状态 |
merge_request_id |
Integer |
合并请求id 取值范围: 1-2147483647 |
created_at |
String |
创建时间 |
updated_at |
String |
更新时间 |
base_commit_sha |
String |
base commit节点 |
real_size |
String |
diff文件数量 |
head_commit_sha |
String |
head commit节点 |
start_commit_sha |
String |
start commit节点 |
commits_count |
Integer |
commit数量 取值范围: 1-2147483647 |
external_diff |
String |
外部diff文件 |
external_diff_store |
Integer |
外部差异存储 取值范围: 1-2147483647 |
stored_externally |
Boolean |
是否外部存储 |
added_lines |
Integer |
新增行数 取值范围: 0-2147483647 |
removed_lines |
Integer |
删除行数 取值范围: 0-2147483647 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
Integer |
评审人id 取值范围: 1-2147483647 |
username |
String |
评审人名称 |
name |
String |
评审人名称 |
nick_name |
String |
评审人昵称 |
state |
Boolean |
评审人状态 |
score |
Integer |
打分 取值范围: -2-2 |
tenant_name |
String |
租户名称 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
Integer |
关联id 取值范围: 1-2147483647 |
user_id |
String |
用户id |
repo_id |
Integer |
仓库id 取值范围: 1-2147483647 |
merge_request_id |
Integer |
合并请求id 取值范围: 1-2147483647 |
target_branch |
String |
目标分支 |
source_branch |
String |
源分支 |
merge_request_title |
String |
合并请求标题 |
merge_request_url |
String |
合并请求url |
merge_request_state |
String |
合并请求状态 |
related_id |
String |
关联单id |
related_title |
String |
关联单标题 |
related_url |
String |
关联单url |
result |
Integer |
关联结果 |
message |
String |
关联结果信息 |
create_at |
String |
创建时间 |
update_at |
String |
更新时间 |
subject |
String |
话题 |
tracker |
Object |
跟单人 |
status |
Object |
状态 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
Integer |
用户id 取值范围: 1-2147483647 |
username |
String |
用户名称 |
name |
String |
用户名称 |
nick_name |
String |
用户昵称 |
name_cn |
String |
中文名称 |
|
String |
电子邮箱 |
state |
String |
状态 |
updated_at |
String |
更新时间 |
avatar_url |
String |
头像url |
tenant_name |
String |
租户名称 |
approver_comment |
String |
审核意见 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
Integer |
仓库id |
description |
String |
仓库描述信息 |
name |
String |
仓库名称 |
name_with_namespace |
String |
组织名/组织名.../仓库名 |
path |
String |
仓库路径 |
path_with_namespace |
String |
仓库完整路径 |
created_at |
String |
创建时间 |
updated_at |
String |
更新时间 |
archived |
Boolean |
是否归档 |
is_kia |
Boolean |
是否机密 |
ssh_url_to_repo |
String |
仓库ssh地址 |
http_url_to_repo |
String |
仓库http地址 |
web_url |
String |
仓库页面链接 |
readme_url |
String |
仓库readme文件链接 |
project_id |
String |
项目id |
project_name |
String |
项目名称 |
develop_mode |
String |
仓库开发模式:normal、CR |
moderation_result |
Boolean |
审核状态 |
状态码:401
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
参数解释: 错误码。 |
error_msg |
String |
参数解释: 错误信息。 |
请求示例
/v4/repositories/123/merge-requests/123 { "title" : "test-title", "state_event" : "reopen", "assignee_ids" : "111,222", "reviewer_ids" : "111,222", "description" : "test-desc", "milestone_id" : 111, "labels" : "222,333", "force_remove_source_branch" : true, "squash" : "squash提交信息", "work_item_ids" : [ "US123456", "US456789" ] }
响应示例
状态码:200
OK
{ "id" : 1242586, "iid" : 1, "title" : "更新 README.md", "description" : "merge \\asfd\\ into \\master\\\\n更新 README.md", "state" : "opened", "created_at" : "2024-08-14T14:17:39.000+08:00", "updated_at" : "2025-01-06T15:38:31.000+08:00", "source_branch" : "asfd", "target_branch" : "master", "is_source_branch_protected" : false, "devcloud_source_branch" : "asfd", "author" : { "id" : 1130646, "name" : "example_name", "username" : "7806db92698840d794a70e53e1295cb7", "state" : "active", "avatar_url" : null, "web_url" : "https://example.com/7806db92698840d794a70e53e1295cb7", "nick_name" : "example_name", "tenant_name" : "example_name" }, "source_repository_id" : 2663641, "target_repository_id" : 2663641, "source_project_id" : "07c8683c4bb0445393c5eab0ea354003", "target_project_id" : "07c8683c4bb0445393c5eab0ea354003", "labels" : [ ], "work_in_progress" : false, "merge_when_build_succeeds" : false, "merge_status" : "can_be_merged", "sha" : "2032553aab2bbe1855687885da9165412b3fa3a4", "subscribed" : true, "user_notes_count" : 0, "force_remove_source_branch" : false, "web_url" : "https://example.com/********/2663641/1/mergedetail?source\\u003dasfd\\u0026target\\u003dmaster", "merge_request_diff" : { "id" : 1286204, "state" : "collected", "merge_request_id" : 1242586, "created_at" : "2024-08-14T14:17:39.000+08:00", "updated_at" : "2024-08-14T14:17:39.000+08:00", "base_commit_sha" : "cdb34fb2431d57aaf6701b4026425acde1d8a84c", "real_size" : 1, "head_commit_sha" : "2032553aab2bbe1855687885da9165412b3fa3a4", "start_commit_sha" : "cdb34fb2431d57aaf6701b4026425acde1d8a84c", "commits_count" : 1, "external_diff" : "diff-1286204", "external_diff_store" : 1, "stored_externally" : true, "added_lines" : 1, "removed_lines" : 1 }, "merge_request_reviewers_count" : 0, "merge_request_review_count" : 0, "merge_request_reviewer_list" : [ ], "merge_request_assignee_list" : [ ], "notes" : 0, "codecheck_state" : 7, "codecheck_defect_count" : 0, "merge_request_related_work_items" : [ ], "diverged_commits_count" : 0, "moderation_result" : true, "moderation_time" : 0, "moderation_status" : 0, "is_use_temp_branch" : false, "approval_merge_request_approvers" : [ ], "review_mode" : "approval", "squash" : false, "source_repository" : { "id" : 2663641, "description" : null, "name" : "mr_test", "name_with_namespace" : "07c8683c4bb0445393c5eab0ea354003 / mr_test", "path" : "mr_test", "path_with_namespace" : "07c8683c4bb0445393c5eab0ea354003/mr_test", "created_at" : "2024-08-05T11:32:27.000+08:00", "updated_at" : "2024-08-05T11:32:27.000+08:00", "archived" : false, "is_kia" : false, "ssh_url_to_repo" : "git@example.com:07c8683c4bb0445393c5eab0ea354003/mr_test.git", "http_url_to_repo" : "https://example.com/07c8683c4bb0445393c5eab0ea354003/mr_test.git", "web_url" : "https://example.com/07c8683c4bb0445393c5eab0ea354003/mr_test", "project_id" : "07c8683c4bb0445393c5eab0ea354003", "project_name" : "sll_test", "develop_mode" : "normal", "moderation_result" : true }, "target_repository" : { "id" : 2663641, "description" : null, "name" : "mr_test", "name_with_namespace" : "07c8683c4bb0445393c5eab0ea354003 / mr_test", "path" : "mr_test", "path_with_namespace" : "07c8683c4bb0445393c5eab0ea354003/mr_test", "created_at" : "2024-08-05T11:32:27.000+08:00", "updated_at" : "2024-08-05T11:32:27.000+08:00", "archived" : false, "is_kia" : false, "ssh_url_to_repo" : "git@example.com:07c8683c4bb0445393c5eab0ea354003/mr_test.git", "http_url_to_repo" : "https://example.com/07c8683c4bb0445393c5eab0ea354003/mr_test.git", "web_url" : "https://example.com/07c8683c4bb0445393c5eab0ea354003/mr_test", "project_id" : "07c8683c4bb0445393c5eab0ea354003", "project_name" : "sll_test", "develop_mode" : "normal", "moderation_result" : true }, "is_source_branch_exist" : true, "merge_request_type" : "MergeRequest" }
状态码:401
Unauthorized
{ "error_code" : "DEV.00000003", "error_msg" : "认证信息过期" }
状态码
状态码 |
描述 |
---|---|
200 |
OK |
401 |
Unauthorized |
错误码
请参见错误码。