从tfschangeset获取文件列表 [英] Get list of files from tfs changeset
问题描述
我只需要从chageset获取已更改文件的列表,而排除所有其他垃圾.
I need to get a list of changed files from chageset only and exclude all other junk.
我可以从命令tf changeset/i $ {changesetnumber)获得此信息,但是除了文件列表之外,我还有很多其他我不需要的信息.
I can get this information from the command tf changeset /i $(changesetnumber) but besides of List of files i have a lot of other information which I dont need for my purposes.
或者也许有人可以告诉您如何从ccnet获取此文件列表,以便我可以通过属性将其发送到msbuild.proj文件中.
Or maybe someone can tell how to get this list of files from ccnet so I can send it to my msbuild.proj file via property.
推荐答案
您可以使用TFS API来获取所需的信息.这是一些示例C#代码,它将选择所有已编辑,已添加和已删除文件的文件名
You could use the TFS API to get the information you want. Here's some example C# code that will select the file names of all edited, added and deleted files
Uri serverUri = new Uri("http://mytfsserver:8080/");
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(serverUri);
tpc.EnsureAuthenticated();
VersionControlServer vcs = tpc.GetService<VersionControlServer>();
var changeset = vcs.GetChangeset(changesetId);
var changedFiles = from change in changeset.Changes where
( (change.ChangeType & ChangeType.Edit) == ChangeType.Edit
|| (change.ChangeType & ChangeType.Add) == ChangeType.Add
|| (change.ChangeType & ChangeType.Delete) == ChangeType.Delete)
select change.Item.ServerItem;
恐怕我没有使用过cc.net,因此无法建议将其集成到ccnet的最佳方法,但是您可以将其编译成一个小的实用程序,或用脚本语言(例如Powershell, IronPython)
I'm afraid I haven't used cc.net so can't advise on the best way to integrate this into ccnet, but you could compile it into a small utility or rewrite it in a scripting language (e.g. Powershell, IronPython)
这篇关于从tfschangeset获取文件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!