I want to get the checkin(s) that triggered a build for a build definition when the repository is TFS 2013 + Git.
My first approach was:
var commits = buildDetail.Information.GetNodesByType("AssociatedCommit")
Which I got from How to retrieve changesets associated with a build in TFS 2013 with Git? That works great when the build is completed, but it fails to return anything when the build is in progress. I might be missing something here, so if you know what I'm doing wrong above ignore the rest of this post.
My next idea is to get the build definition's workspace mapping and query for checkins against that path.
For non-git projects in TFS you used to be able to get latest changeset for a path like this:
versionControlServer = projectCollection.GetService<VersionControlServer>();
versionControlServer.QueryHistory(path,
VersionSpec.Latest,
DELETION_ID,
RecursionType.Full,
null,
null,
VersionSpec.Latest,
1,
true,
false,
true)
However TFS 2013 + Git doesn't use changesets, it uses commits (not to mention the difference in branching, which doesn't even appear to be in the workspace mapping api) and thus the API appears to be completely different. But there doesn't appear to be any documentation on what the new API is.
Any links to documentation that I might have missed, alternate approaches or insights would be greatly appreciated.