問題描述
Team Foundation 服務器上變更集註釋的位置? (Location of changeset comments on a Team Foundation server?)
One of my colleagues is working on a Continuous Integration build script that makes a new build every time a developer makes a checkin, and sends an email out to the development team when the build finishes. We want to take any comments associated with the checkin (the same comments you'd see by right-clicking on a project file and selecting View History) and include them in the email. However, we're not sure where in the back-end of TFS to point the script so it can retrieve those comments. Does anyone know where we should look?
參考解法
方法 1:
Are you using TFS API for that? If so, you simply do:
<pre class="lang-cs prettyprint-override">TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer("http://WhateverServerUrl");
IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer));
VersionControlServer VsServer = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
IBuildDetail build = buildServer.GetAllBuildDetails(new Uri("http://WhateverBuildUrl"));
List<IChangesetSummary> associatedChangesets = InformationNodeConverters.GetAssociatedChangesets(build);
foreach (IChangesetSummary changeSetData in associatedChangesets)
{
Changeset changeSet = VsServer.GetChangeset(changeSetData.ChangesetId);
string x = changeSet.Comment;
}
</code></pre>
If you are trying to look it up in the DB, you can look at the changeset title:
<pre class="lang-sql prettyprint-override">USE tfs_warehouse SELECT [ChangesetID] ,[ChangesetTitle] FROM [tfs_warehouse].[dbo].[DimChangeset]
</pre>
From here add a where clause to either the id, date etc.
This is where that data is stored in TFS 2010.
In TFS 2008, you would use TfsWarehouse and look at dbo.ChangeSet Changset column.
(by estanford、Mike Veigel)
參考文件