1

我们有一个签到记录的团队项目集合源代码控制设置,要求每次签到都捕获一个“跟踪号”。此数字在 TFS 外部。我需要搜索具有特定跟踪编号的所有变更集。

生成的变更集列表告诉我在 GetLatest 上进行哪些每月部署。

-- 我们不使用工作项

这个 .SQL 给了我正在寻找的列表。我想从 Visual Studio 的代码中访问它。

SELECT ReleaseNoteId, FieldName, BaseValue
from Tfs_DefaultCollection.dbo.tbl_ReleaseNoteDetails
  where ReleaseNoteId in (SELECT ReleaseNoteId
FROM Tfs_DefaultCollection.dbo.tbl_ReleaseNote
  where DateCreated between '2013-01-01' and '2013-01-31')
    and FieldName = 'Tracker #'
    and BaseValue = '18570'

哪些对象引用可用于 Tfs_DefaultCollection.dbo.tbl_ReleaseNoteDetails?

4

2 回答 2

0

There is no 1to1 object reference in the TFS API, because you usually don't work on the structure like the database looks like.

What I understand from your description, you have the information you need in the changesets. In that case you could use the VersionControlServer to get the changesets and get the information from there.

TfsTeamProjectCollection tfsConnection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://TFS:8080/TFS/DefaultCollection"));
VersionControlServer sourceControl = (VersionControlServer)tfsConnection.GetService(typeof(VersionControlServer));
IEnumerable changesets = sourceControl.QueryHistory(ServerPath, VersionSpec.Latest, 0, RecursionType.Full, null, new DateVersionSpec (new DateTime(2013,1,1)), new DateVersionSpec (new DateTime(2013,1,31)), Int32.MaxValue, true, false);
foreach (Changeset change in changesets)
{
  // check where the information is stored in the changeset, may change.Changes
}

Just an idea to get in the right direction.

于 2013-01-31T16:48:20.343 回答
0

如果您想轻松查询和搜索,最好创建一个新的工作项字段并在签入期间关联工作项。工作项在 UI 中具有完整的查询功能,甚至可以传输到 Reporting 仓库。

您可以使用对象检索特定文件夹、日期范围等的历史记录,QueryHistoryParameters然后遍历CheckinNotesto 过滤器:

  var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(
      new Uri("http://localhost:8080/tfs/DefaultCollection"));
  var versionControlServer = projectCollection.GetService<VersionControlServer>();

  var query = new QueryHistoryParameters("$/Scrum/**", RecursionType.Full);
  var changesets = server.QueryHistory(query);

  changesets.Where(cs => cs.CheckinNotes.Any(note => note.PropertyName == "Tracker #" 
       && note.Value == "18570"))

这不会非常快。要获得快速解决方案,请使用工作项关联。

于 2013-01-31T21:24:27.193 回答