Commits - Get Push Commits
检索与特定推送关联的提交列表。
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits?pushId={pushId}&api-version=5.0
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits?pushId={pushId}&top={top}&skip={skip}&includeLinks={includeLinks}&api-version=5.0
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
organization
|
path | True |
string |
Azure DevOps 组织的名称。 |
|
repository
|
path | True |
string |
存储库的 ID 或友好名称。 若要使用友好名称,还必须指定 projectId。 |
|
project
|
path |
string |
项目 ID 或项目名称 |
|
|
api-version
|
query | True |
string |
要使用的 API 版本。 应将其设置为“5.0”才能使用此版本的 API。 |
|
push
|
query | True |
integer int32 |
推送的 ID。 |
|
include
|
query |
boolean |
设置为 false 可避免包含资源的 REST URL 链接。 默认为 true。 |
|
|
skip
|
query |
integer int32 |
要跳过的提交数。 |
|
|
top
|
query |
integer int32 |
要返回的最大提交数 (“get the top x commits”) 。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 200 OK |
成功的操作 |
安全性
oauth2
类型:
oauth2
流向:
accessCode
授权 URL:
https://app.vssps.visualstudio.com/oauth2/authorize&response_type=Assertion
令牌 URL:
https://app.vssps.visualstudio.com/oauth2/token?client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
作用域
| 名称 | 说明 |
|---|---|
| vso.code | 授予读取有关提交、更改集、分支和其他版本控制项目的源代码和元数据的能力。 此外,还授予搜索代码的功能,并通过服务挂钩获取有关版本控制事件的通知。 |
示例
示例请求
GET https://dev.azure.com/fabrikam/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/commits?pushId=1&api-version=5.0
示例响应
{
"count": 1,
"value": [
{
"commitId": "be67f8871a4d2c75f13a51c1d3c30ac0d74d4ef4",
"author": {
"name": "Chuck Reinhart",
"email": "fabrikamfiber3@hotmail.com",
"date": "2014-01-29T23:32:09Z"
},
"committer": {
"name": "Chuck Reinhart",
"email": "fabrikamfiber3@hotmail.com",
"date": "2014-01-29T23:32:09Z"
},
"comment": "First cut",
"url": "https://dev.azure.com/fabrikam/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/commits/be67f8871a4d2c75f13a51c1d3c30ac0d74d4ef4",
"remoteUrl": "https://dev.azure.com/fabrikam/_git/Fabrikam-Fiber-Git/commit/be67f8871a4d2c75f13a51c1d3c30ac0d74d4ef4",
"_links": {
"self": {
"href": "https://dev.azure.com/fabrikam/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/commits/be67f8871a4d2c75f13a51c1d3c30ac0d74d4ef4"
},
"repository": {
"href": "https://dev.azure.com/fabrikam/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249"
},
"web": {
"href": "https://dev.azure.com/fabrikam/_git/Fabrikam-Fiber-Git/commit/be67f8871a4d2c75f13a51c1d3c30ac0d74d4ef4"
},
"changes": {
"href": "https://dev.azure.com/fabrikam/_apis/git/repositories/278d5cd2-584d-4b63-824a-2ba458937249/commits/be67f8871a4d2c75f13a51c1d3c30ac0d74d4ef4/changes"
}
}
}
]
}
定义
| 名称 | 说明 |
|---|---|
|
Change |
|
|
Git |
|
|
Git |
提供描述 Git 提交和关联元数据的属性。 |
|
Git |
|
|
Git |
此类包含发布状态的服务/扩展的元数据。 |
|
Git |
唯一标识状态的状态上下文。 |
|
Git |
状态的状态。 |
|
Git |
|
|
Git |
Git 操作的用户信息和日期。 |
|
Identity |
|
|
Item |
|
|
Item |
|
|
Reference |
表示 REST 引用链接集合的类。 |
|
Resource |
|
|
Version |
对项所做的更改的类型。 |
ChangeCountDictionary
GitChange
| 名称 | 类型 | 说明 |
|---|---|---|
| changeId |
integer |
更改组中更改的 ID。 |
| changeType |
对项所做的更改的类型。 |
|
| item |
string |
当前版本。 |
| newContent |
更改后项的内容。 |
|
| newContentTemplate |
推送新更改时要使用的新内容模板。 |
|
| originalPath |
string |
项的原始路径(如果不同于当前路径)。 |
| sourceServerItem |
string |
服务器上的项的路径。 |
| url |
string |
用于检索项的 URL。 |
GitCommitRef
提供描述 Git 提交和关联元数据的属性。
| 名称 | 类型 | 说明 |
|---|---|---|
| _links |
相关 REST 引用链接的集合。 |
|
| author |
提交的作者。 |
|
| changeCounts |
提交中包含的更改类型 (编辑、删除等) 计数。 |
|
| changes |
提交中包含的更改的枚举。 |
|
| comment |
string |
提交注释或消息。 |
| commentTruncated |
boolean |
指示注释是否从完整的 Git 提交注释消息中截断。 |
| commitId |
string |
提交的 ID (SHA-1) 。 |
| committer |
提交的提交者。 |
|
| parents |
string[] |
此提交的父提交 ID 的枚举。 |
| push |
与此提交关联的推送。 |
|
| remoteUrl |
string |
提交的远程 URL 路径。 |
| statuses |
来自服务和扩展的状态元数据的列表,这些元数据可能会将其他信息关联到提交。 |
|
| url |
string |
此资源的 REST URL。 |
| workItems |
与此提交关联的工作项列表。 |
GitPushRef
| 名称 | 类型 | 说明 |
|---|---|---|
| _links |
表示 REST 引用链接集合的类。 |
|
| date |
string |
|
| pushId |
integer |
|
| pushedBy | ||
| url |
string |
GitStatus
此类包含发布状态的服务/扩展的元数据。
| 名称 | 类型 | 说明 |
|---|---|---|
| _links |
参考链接。 |
|
| context |
状态的上下文。 |
|
| createdBy |
创建状态的标识。 |
|
| creationDate |
string |
状态的创建日期和时间。 |
| description |
string |
状态说明。 通常描述状态的当前状态。 |
| id |
integer |
状态标识符。 |
| state |
状态的状态。 |
|
| targetUrl |
string |
包含状态详细信息的 URL。 |
| updatedDate |
string |
状态的上次更新日期和时间。 |
GitStatusContext
唯一标识状态的状态上下文。
| 名称 | 类型 | 说明 |
|---|---|---|
| genre |
string |
状态的流派。 生成状态的服务/工具的名称通常可以为空。 |
| name |
string |
状态的名称标识符不能为 null 或空。 |
GitStatusState
状态的状态。
| 值 | 说明 |
|---|---|
| error |
出现错误的状态。 |
| failed |
状态失败。 |
| notApplicable |
状态不适用于目标对象。 |
| notSet |
状态状态未设置。 默认状态。 |
| pending |
状态挂起。 |
| succeeded |
状态成功。 |
GitTemplate
| 名称 | 类型 | 说明 |
|---|---|---|
| name |
string |
模板的名称 |
| type |
string |
模板的类型 |
GitUserDate
Git 操作的用户信息和日期。
| 名称 | 类型 | 说明 |
|---|---|---|
| date |
string |
Git 操作的日期。 |
|
string |
Email执行 Git 操作的用户的地址。 |
|
| imageUrl |
string |
用户头像的 URL。 |
| name |
string |
执行 Git 操作的用户的名称。 |
IdentityRef
| 名称 | 类型 | 说明 |
|---|---|---|
| _links |
此字段包含零个或多个有关图形主题的有趣链接。 可以调用这些链接来获取有关此图主题的其他关系或更详细的信息。 |
|
| descriptor |
string |
描述符是在系统运行时引用图形主题的主要方法。 此字段将唯一标识帐户和组织中的同一图形主题。 |
| directoryAlias |
string |
|
| displayName |
string |
这是图形主题的非唯一显示名称。 若要更改此字段,必须在源提供程序中更改其值。 |
| id |
string |
|
| imageUrl |
string |
|
| inactive |
boolean |
|
| isAadIdentity |
boolean |
|
| isContainer |
boolean |
|
| isDeletedInOrigin |
boolean |
|
| profileUrl |
string |
|
| uniqueName |
string |
|
| url |
string |
此 URL 是指向此图主题的源资源的完整路由。 |
ItemContent
| 名称 | 类型 | 说明 |
|---|---|---|
| content |
string |
|
| contentType |
ItemContentType
| 值 | 说明 |
|---|---|
| base64Encoded | |
| rawText |
ReferenceLinks
表示 REST 引用链接集合的类。
| 名称 | 类型 | 说明 |
|---|---|---|
| links |
object |
链接的只读视图。 由于引用链接是只读的,因此我们只想将其公开为只读。 |
ResourceRef
| 名称 | 类型 | 说明 |
|---|---|---|
| id |
string |
|
| url |
string |
VersionControlChangeType
对项所做的更改的类型。
| 值 | 说明 |
|---|---|
| add | |
| all | |
| branch | |
| delete | |
| edit | |
| encoding | |
| lock | |
| merge | |
| none | |
| property | |
| rename | |
| rollback | |
| sourceRename | |
| targetRename | |
| undelete |