获取提交关联的合并请求
功能介绍
获取提交关联的合并请求
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
URI
GET /v4/repositories/{repository_id}/commits/{sha}/merge-requests
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
repository_id |
是 |
Integer |
参数解释: 仓库的ID,通过查询用户所有仓库接口查询项目列表获取。 约束限制: 不涉及。 取值范围: 1-2147483647 |
sha |
是 |
String |
参数解释: 提交ID。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
offset |
否 |
Integer |
参数解释: 偏移量,从0开始。 取值范围: 0-2147483647 默认取值: 0 |
limit |
否 |
Integer |
参数解释: 返回数量。 取值范围: 1-100 默认取值: 20 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
参数解释: 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 约束限制: 必传。 取值范围: 字符串长度不少于1,不超过10万。 默认取值: 不涉及。 |
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
[数组元素] |
Array of CommitMergeRequestDto objects |
提交关联的合并请求详情 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
Integer |
参数解释: 合并请求的ID。 |
iid |
Integer |
参数解释: 合并请求的序号。 |
title |
String |
参数解释: 合并请求的标题。 |
description |
String |
参数解释: 合并请求的详细描述。 |
state |
String |
参数解释: 合并请求的状态。 |
created_at |
String |
参数解释: 合并请求创建的时间。 |
updated_at |
String |
参数解释: 合并请求最后一次更新的时间。 |
merged_by |
UserBasicDto object |
参数解释: 合并请求的合并者信息。 |
merged_at |
String |
参数解释: 合并请求被合并的时间。 |
closed_by |
UserBasicDto object |
参数解释: 合并请求的关闭者信息。 |
closed_at |
String |
参数解释: 合并请求被关闭的时间。 |
target_branch |
String |
参数解释: 合并请求的目标分支名称。 |
source_branch |
String |
参数解释: 合并请求的源分支名称。 |
user_notes_count |
Integer |
参数解释: 合并请求中检视意见的数量。 |
upvotes |
Integer |
参数解释: 合并请求的正向评分数量。 |
downvotes |
Integer |
参数解释: 合并请求的负向评分数量。 |
author |
UserBasicDto object |
参数解释: 合并请求的作者信息。 |
assignee |
Array of UserBasicDto objects |
参数解释: 合并请求的可合并人列表。 |
source_repository_id |
Integer |
参数解释: 源仓库的唯一标识符。 |
target_repository_id |
Integer |
参数解释: 目标仓库的唯一标识符。 |
labels |
Array of strings |
参数解释: 合并请求关联的标签列表。 |
work_in_progress |
Boolean |
参数解释: 表示合并请求是否处于“工作进行中”状态。 |
milestone |
MilestoneBasicDto object |
参数解释: 合并请求关联的里程碑信息。 |
merge_when_pipeline_succeeds |
Boolean |
参数解释: 表示是否在CI/CD管道成功时自动合并请求。 |
merge_status |
String |
参数解释: 合并请求的合并状态。 |
sha |
String |
参数解释: 合并请求的提交哈希值。 |
merge_commit_sha |
String |
参数解释: 合并提交的哈希值。 |
discussion_locked |
Boolean |
参数解释: 表示合并请求的讨论是否被锁定。 |
force_remove_source_branch |
Boolean |
参数解释: 表示是否强制删除源分支。 |
should_remove_source_branch |
Boolean |
参数解释: 表示是否应该删除源分支。 |
allow_collaboration |
Boolean |
参数解释: 表示是否允许协作者参与。 |
allow_maintainer_to_push |
Boolean |
参数解释: 表示是否允许维护者推送代码。 |
web_url |
String |
参数解释: 合并请求的网页URL链接。 |
time_stats |
IssuableTimeStatsDto object |
参数解释: 合并请求的时间统计信息。 |
squash |
Boolean |
参数解释: 表示是否在合并时将提交压缩为一个。 |
merge_request_type |
String |
参数解释: 合并请求的类型。 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
Integer |
参数解释: 用户id。 取值范围: 1-2147483647 |
name |
String |
参数解释: 用户名称。 |
username |
String |
参数解释: 用户名。 |
state |
String |
用户状态 |
service_license_status |
Integer |
服务级权限状态 0:停用 1:启用 |
avatar_url |
String |
用户头像url |
avatar_path |
String |
用户头像路径 |
|
String |
用户邮箱 |
name_cn |
String |
用户中文名称 |
web_url |
String |
用户个人首页 |
nick_name |
String |
用户昵称 |
tenant_name |
String |
租户名称 |
error_message |
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 |
参数 |
参数类型 |
描述 |
---|---|---|
time_estimate |
Integer |
合并请求时间估计 默认取值: 0 |
total_time_spent |
Integer |
合并请求总时长 默认取值: 0 |
human_time_estimate |
String |
合并请求人类时间估计 |
human_total_time_spent |
String |
合并请求人类总时长 |
状态码:401
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
参数解释: 错误码。 |
error_msg |
String |
参数解释: 错误信息。 |
状态码:404
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
参数解释: 错误码。 |
error_msg |
String |
参数解释: 错误信息。 |
请求示例
无
响应示例
状态码:200
ok
{ "id" : 72674, "iid" : 7, "title" : "新建文件", "description" : "test", "state" : "opened", "created_at" : "2025-05-21T20:03:32.000+08:00", "updated_at" : "2025-06-17T23:30:02.000+08:00", "merged_by" : null, "merged_at" : null, "closed_by" : null, "closed_at" : "2025-05-21T12:03:32.000+08:00", "target_branch" : "master", "source_branch" : "ddd1", "user_notes_count" : 0, "upvotes" : 0, "downvotes" : 0, "author" : { "id" : 9124, "name" : "example_name", "username" : "c369c68f1ff84679b5a8ed904d8bff1c", "state" : "active", "service_license_status" : null, "name_cn" : "c369c68f1ff84679b5a8ed904d8bff1c", "nick_name" : null, "tenant_name" : null, "error_message" : null }, "assignee" : null, "source_repository_id" : 2111983939, "target_repository_id" : 2111983939, "labels" : [ "Bug", "bug" ], "work_in_progress" : false, "milestone" : null, "merge_when_pipeline_succeeds" : false, "merge_status" : "can_be_merged", "sha" : "2ce8081da020a9bc394164925394b3de7609c7a0", "merge_commit_sha" : null, "discussion_locked" : null, "force_remove_source_branch" : false, "should_remove_source_branch" : false, "allow_collaboration" : null, "allow_maintainer_to_push" : null, "web_url" : "https://example.com/********/2111983939/7/mergedetail?source=ddd1&target=master", "time_stats" : { "time_estimate" : null, "total_time_spent" : 0, "human_time_estimate" : null, "human_total_time_spent" : null }, "squash" : false, "merge_request_type" : "MergeRequest" }
状态码:401
Unauthorized
{ "error_code" : "CH.00000002", "error_msg" : "认证信息无法识别" }
状态码
状态码 |
描述 |
---|---|
200 |
ok |
401 |
Unauthorized |
404 |
Not Found |
错误码
请参见错误码。