我们的团队使用TFS来管理以下流程中的工作流:工作项->源代码管理->变更列表->手动部署到服务器
有没有什么方法可以为给定的变更列表获得一个具有完整目录结构的文件列表?理想情况下,我希望能够选择多个变更列表和/或工作项,以获得与工作项关联的所有变更列表,并获得变更列表/工作项中文件的完整目录结构。
任何建议都将不胜感激,谢谢!
您可能可以使用以下代码snippit来启动
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();
}
}