Commits - Get Push Commits
检索与特定推送关联的提交列表。
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits?pushId={pushId}&api-version=7.1
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits?pushId={pushId}&top={top}&skip={skip}&includeLinks={includeLinks}&api-version=7.1
URI 参数
| 名称 | 在 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
organization
|
path | True |
string |
Azure DevOps 组织的名称。 |
|
repository
|
path | True |
string |
存储库的 ID 或友好名称。 若要使用友好名称,还必须指定 projectId。 |
|
project
|
path |
string |
项目 ID 或项目名称 |
|
|
api-version
|
query | True |
string |
要使用的 API 版本。 这应设置为“7.1”才能使用此版本的 API。 |
|
push
|
query | True |
integer (int32) |
推送的 ID。 |
|
include
|
query |
boolean |
设置为 false 以避免包括资源的 REST URL 链接。 默认值为 true。 |
|
|
skip
|
query |
integer (int32) |
要跳过的提交数。 |
|
|
top
|
query |
integer (int32) |
要返回的最大提交数(“获取前 x 个提交”)。 |
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| 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=7.1
示例响应
{
"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 (int32) |
更改组中更改的 ID。 |
| changeType |
对项所做的更改的类型。 |
|
| item |
string (T) |
当前版本。 |
| 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)。 |
| commitTooManyChanges |
boolean |
指示提交包含过多的更改无法显示 |
| committer |
提交者。 |
|
| parents |
string[] |
此提交的父提交 ID 的枚举。 |
| push |
与此提交关联的推送。 |
|
| remoteUrl |
string |
提交远程 URL 路径。 |
| statuses |
服务和扩展中的状态元数据列表,这些元数据可能会将其他信息与提交相关联。 |
|
| url |
string |
此资源的 REST URL。 |
| workItems |
与此提交关联的工作项列表。 |
GitPushRef
| 名称 | 类型 | 说明 |
|---|---|---|
| _links |
表示 REST 引用链接集合的类。 |
|
| date |
string (date-time) |
|
| pushId |
integer (int32) |
|
| pushedBy | ||
| url |
string |
GitStatus
此类包含发布状态的服务/扩展的元数据。
| 名称 | 类型 | 说明 |
|---|---|---|
| _links |
参考链接。 |
|
| context |
状态的上下文。 |
|
| createdBy |
创建状态的标识。 |
|
| creationDate |
string (date-time) |
状态的创建日期和时间。 |
| description |
string |
状态说明。 通常描述状态的当前状态。 |
| id |
integer (int32) |
状态标识符。 |
| state |
状态。 |
|
| targetUrl |
string |
包含状态详细信息的 URL。 |
| updatedDate |
string (date-time) |
状态的上次更新日期和时间。 |
GitStatusContext
唯一标识状态的状态上下文。
| 名称 | 类型 | 说明 |
|---|---|---|
| genre |
string |
状态的流派。 通常,生成状态的服务/工具的名称可以为空。 |
| name |
string |
状态的名称标识符不能为 null 或为空。 |
GitStatusState
状态。
| 值 | 说明 |
|---|---|
| error |
状态,出现错误。 |
| failed |
状态失败。 |
| notApplicable |
状态不适用于目标对象。 |
| notSet |
未设置状态。 默认状态。 |
| pending |
状态挂起。 |
| succeeded |
状态成功。 |
GitTemplate
| 名称 | 类型 | 说明 |
|---|---|---|
| name |
string |
模板的名称 |
| type |
string |
模板的类型 |
GitUserDate
Git作的用户信息和日期。
| 名称 | 类型 | 说明 |
|---|---|---|
| date |
string (date-time) |
Git作的日期。 |
|
string |
执行 Git作的用户的电子邮件地址。 |
|
| imageUrl |
string |
用户的头像的 URL。 |
| name |
string |
执行 Git作的用户的名称。 |
IdentityRef
| 名称 | 类型 | 说明 |
|---|---|---|
| _links |
此字段包含有关图形主题的零个或多个有趣的链接。 可以调用这些链接以获取有关此图形主题的其他关系或更详细的信息。 |
|
| descriptor |
string |
描述符是在系统运行时引用图形主题的主要方法。 此字段将唯一标识帐户和组织中的同一图形主题。 |
| directoryAlias |
string |
已弃用 - 可以通过查询 IdentityRef“_links”字典的“self”条目中引用的 Graph 用户来检索 |
| displayName |
string |
这是图形主题的非唯一显示名称。 若要更改此字段,必须在源提供程序中更改其值。 |
| id |
string |
|
| imageUrl |
string |
已弃用 - 在 IdentityRef“_links”字典的“虚拟形象”条目中可用 |
| inactive |
boolean |
已弃用 - 可以通过查询 GraphUser“_links”字典的“membershipState”条目中引用的 Graph 成员身份状态来检索 |
| isAadIdentity |
boolean |
已弃用 - 可以从描述符的主题类型推断(Descriptor.IsAadUserType/Descriptor.IsAadGroupType) |
| isContainer |
boolean |
已弃用 - 可以从描述符的主题类型推断(描述符.IsGroupType) |
| isDeletedInOrigin |
boolean |
|
| profileUrl |
string |
已弃用 - 不在 ToIdentityRef 的大多数预先存在的实现中使用 |
| uniqueName |
string |
已弃用 - 请改用 Domain+PrincipalName |
| 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 |