Get list of files from tfs changeset

后端 未结 2 1316
孤城傲影
孤城傲影 2021-01-25 13:24

I need to get a list of changed files from chageset only and exclude all other junk.

I can get this information from the command tf changeset /i $(changesetnumber) but b

2条回答
  •  孤街浪徒
    2021-01-25 13:48

    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();
    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;
    

    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)

提交回复
热议问题