gpt4 book ai didi

c# - 如何以编程方式查找 TFS 2010 中变更集中单个文件的代码变动信息?

转载 作者:太空狗 更新时间:2023-10-29 22:54:45 26 4
gpt4 key购买 nike

我需要能够以编程方式查找 TFS 2010 中变更集中单个文件的代码变动信息(添加、更改、删​​除的行)。我需要执行此操作的程序是桌面客户端应用程序。

有人知道怎么做吗?您有想要分享的示例代码吗?

最佳答案

这里是一个起点:

        TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer("http://WhateverServerUrl");
IBuildServer buildServer = (IBuildServer)tfs.GetService(typeof(IBuildServer));
VersionControlServer VsServer = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
IBuildDetail build = buildServer.GetAllBuildDetails(new Uri("http://WhateverBuildUrl"));

List<IChangesetSummary> associatedChangesets = InformationNodeConverters.GetAssociatedChangesets(build);


foreach (IChangesetSummary changeSetData in associatedChangesets)
{
Changeset changeSet = VsServer.GetChangeset(changeSetData.ChangesetId);
foreach (Change change in changeSet.Changes)
{
bool a = change.Item.IsContentDestroyed;
long b = change.Item.ContentLength;
}
}

变更集有以下内容:

    public Change[] Changes { get; set; }
public int ChangesetId { get; set; }
public CheckinNote CheckinNote { get; set; }
public string Comment { get; set; }
public string Committer { get; set; }
public DateTime CreationDate { get; set; }
public string Owner { get; set; }

变化有以下几点:

    public ChangeType ChangeType { get; }
public Item Item { get; }
public ReadOnlyCollection<MergeSource> MergeSources { get; }

项目具有以下内容:

    public Uri ArtifactUri { get; }
public Uri ArtifactUriLatestItemVersion { get; }
public int ChangesetId { get; }
public DateTime CheckinDate { get; }
public static IComparer Comparer { get; }
public long ContentLength { get; }
public int DeletionId { get; }
public int Encoding { get; }
public byte[] HashValue { get; }
public bool IsBranch { get; }
public bool IsContentDestroyed { get; }
public int ItemId { get; }
public Stream DownloadFile();
public void DownloadFile(string localFileName);

关于c# - 如何以编程方式查找 TFS 2010 中变更集中单个文件的代码变动信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6431447/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com