文档首页> 代码托管 CodeArts Repo> API参考> API> Repository> 根据组名和仓库名查询某仓库某分支对应的提交
更新时间:2024-01-16 GMT+08:00
分享

根据组名和仓库名查询某仓库某分支对应的提交

功能介绍

根据仓库组名、仓库名和分支获取提交列表。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

GET /v1/repositories/{group_name}/{repository_name}/commits

表1 路径参数

参数

是否必选

参数类型

描述

group_name

String

仓库组名(克隆地址中域名后面仓库名前的一段 示例:git@repo.alpha.devcloud.inhuawei.com:Demo00228/testword.git 组名:Demo00228 )

repository_name

String

仓库名

表2 Query参数

参数

是否必选

参数类型

描述

page_index

Integer

分页索引

page_size

Integer

每页数据量

ref_name

String

分支或标签名,支持SHA格式

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户Token。

通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

error

Error object

响应错误

result

CommitList object

响应结果

status

String

响应状态

表5 Error

参数

参数类型

描述

code

String

错误码

message

String

错误信息

表6 CommitList

参数

参数类型

描述

commits

Array of Commit objects

提交列表

total

Integer

提交总数

表7 Commit

参数

参数类型

描述

author_email

String

作者邮箱

author_name

String

作者

authored_date

String

作者提交时间

committed_date

String

提交时间

committer_email

String

提交作者邮箱

committer_name

String

提交作者

format

Object

文件变更的详情信息,其格式由请求查询参数 stat_format 决定

id

String

提交对应的SHA id

message

String

提交的信息

parent_ids

Array of strings

父提交id

请求示例

GET https://{endpoint}/v1/repositories/{group_name}/{repository_name}/commits

响应示例

状态码: 200

OK

{
  "result" : {
    "total" : 1,
    "commits" : [ {
      "id" : "a27fafa7d8da2dd55f691bef989226d22f50d8ce",
      "message" : "Initial commit",
      "parent_ids" : [ ],
      "authored_date" : null,
      "author_name" : "repo",
      "author_email" : "repo@huawei.com",
      "committed_date" : "2019-10-15 09:40:29",
      "committer_name" : "repo",
      "committer_email" : "repo@huawei.com"
    } ]
  },
  "status" : "success"
}

状态码

状态码

描述

200

OK

错误码

请参见错误码

分享:

    相关文档

    相关产品