Вы можете использовать Builds - Get Build Changes Rest API.
Сценарий PowerShell, например:
$buildId = 1999
$url = http://{tfsServer}:8080/tfs/{collection}/{teamProject}/_apis/build/builds/$($buildId)/changes?api-version=3.0
$response = Invoke-RestMethod -Uri $url -ContentType application/json -Method GET -UseDefaultCredentials
Write-Host "The associated commits to build $($buildId): `n"
For ($i=0; $i -le $response.count - 1; $i++)
{
Write-Host "Commit ID: $($response.value[$i].id)"
Write-Host "Commit Message: $($response.value[$i].message)"
Write-Host "Commit Author: $($response.value[$i].author.displayName)"
Write-Host "------------------------------------------------------"
}
Результаты:
The associated commits to build 1999:
Commit ID: c7d9318beda3950c1aa1b2c63f3a8ecf7
Commit Message: added platform x64
Commit Author: Shayki Abramczyk
------------------------------------------------------
Commit ID: e4a3e6cc4c118a9ffa936a5bf24b0c74
Commit Message: added check to verify tests
Commit Author: John Doe
------------------------------------------------------
Если вы хотите увидеть больше деталей, вы можете использовать Commits - Get Changes Rest API:
Улучшен скрипт выше:
$buildId = 1999
$url = http://{tfsServer}:8080/tfs/{collection}/{teamProject}/_apis/build/builds/$($buildId)/changes?api-version=3.0
$response = Invoke-RestMethod -Uri $url -ContentType application/json -Method GET -UseDefaultCredentials
Write-Host "The associated commits to build $($buildId): `n"
For ($i=0; $i -le $response.count - 1; $i++)
{
Write-Host "Commit ID: $($response.value[$i].id)"
Write-Host "Commit Message: $($response.value[$i].message)"
Write-Host "Commit Author: $($response.value[$i].author.displayName)"
Write-Host "------------------------------------------------------"
$changesUrl = "http://{tfsServer}:8080/tfs/{collection}/{teamProject}/_apis/git/repositories/{repositoryId}/commits/$($response.value[$i].id)/changes?api-version=3.0"
$changes = Invoke-RestMethod -Uri $changesUrl -ContentType application/json -Method GET -UseDefaultCredentials
Write-Host Commits changes:
For ($j=0; $j -le $changes.changeCounts.Edit; $j++)
{
Write-Host $changes.changes[$j].item.path
Write-Host $changes.changes[$j].changeType `n
}
}
Результаты:
Associated commits to build 1999014:
Commit ID: c7d9318beda3950c1aa1b2c63f3a8ecf74be26c3
Commit Message: added platform independent file separator
Commit Author: Kedar Kale
------------------------------------------------------
Commits changes:
/Server
edit
/Server/parent/cognos2/package-cognos2/src/main/java/com/y/ModelController.java
edit
Commit ID: e4a3e6cc4c118a9ffa936a5bf24b0c744b71b5b6
Commit Message: added check to verify BMT File Path for PathManipulation Fortify issue
Commit Author: Kedar Kale
------------------------------------------------------
Commits changes:
/Server/parent/cognos2
edit
/Server/parent/cognos2/package-cognos2/src/main/java/com/y/ModelController.java
edit