【发布时间】:2012-03-13 05:32:00
【问题描述】:
我们的团队使用 TFS 在以下流程中管理工作流: 工作项 -> 源代码控制 -> 变更列表 -> 手动部署到服务器
有没有什么方法可以获取给定更改列表的完整目录结构的文件列表?理想情况下,我希望能够选择多个更改列表和/或工作项来获取与工作项关联的所有更改列表,并获得更改列表/工作项中文件的完整目录结构。
任何建议将不胜感激,谢谢!
【问题讨论】:
标签: deployment tfs
我们的团队使用 TFS 在以下流程中管理工作流: 工作项 -> 源代码控制 -> 变更列表 -> 手动部署到服务器
有没有什么方法可以获取给定更改列表的完整目录结构的文件列表?理想情况下,我希望能够选择多个更改列表和/或工作项来获取与工作项关联的所有更改列表,并获得更改列表/工作项中文件的完整目录结构。
任何建议将不胜感激,谢谢!
【问题讨论】:
标签: deployment tfs
您大概可以使用以下代码片段开始
Uri tfsUri = new Uri(@"http://server:8080/tfs");
string serverPath = @"$/Project";
//Connect to the project collection
var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(
tfsUri, new UICredentialsProvider());
//Get the source code control service.
var sourceControl = projectCollection.GetService<VersionControlServer>();
var history = sourceControl.QueryHistory(
serverPath, //Source control path to the item. Like $/Project/Path ...
LatestVersionSpec.Instance, //Search latest version
0, //No unique deletion id.
RecursionType.Full, //Full recursion on the path
null, //All users
new ChangesetVersionSpec("9829"), //From the 7 days ago ...
LatestVersionSpec.Instance, //To the current version ...
Int32.MaxValue, //Include all changes. Can limit the number you get back.
true, //Include details of items, not just metadata.
false //Slot mode is false.
);
//Enumerate of the changesets.
foreach (Changeset changeset in history.OfType<Changeset>().Take(1))
{
foreach (var change in changeset.Changes)
{
change.Item.ServerItem.Dump();
}
}
【讨论】: