How to get git like statistics from TFS

前端 未结 5 1280
耶瑟儿~
耶瑟儿~ 2021-02-05 11:26

I\'ve been working with TFS for a few months now and would like to get some basic statistics and make them available to our team. In git, i could retrieve statistics on \"commit

5条回答
  •  孤城傲影
    2021-02-05 11:58

    You can use the TFS API to create any queries you like. You can quite easily iterate through the changesets looking for all commits by a certain author, or commits in a certain date:

    TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("http://tfsserver:8080/"));
    tpc.EnsureAuthenticated();
    VersionControlServer vcs = tpc.GetService(); 
    
    int latest = vcs.GetLatestChangesetId();
    DateTime earliestDate = new DateTime(2011, 1, 1);
    do
    {
        var changeset = vcs.GetChangeset(latest);                
        if (changeset.CreationDate < earliestDate)
        {
            break;
        }
        // do analysis of the changeset here,
        // e.g. use changeset.Committer or changeset.Changes
    } while (latest-- > 0);
    

提交回复
热议问题