当我在 Visual Studio 中查看文件的历史记录时,我看到了:
我尝试通过 API 检索这些更改:
var queryParams = new QueryHistoryParameters("$/Project/folder/folder/file.cs", RecursionType.None)
{
ItemVersion = VersionSpec.Latest,
DeletionId = 0,
Author = null,
VersionStart = null,
VersionEnd = null,
MaxResults = Int32.MaxValue,
IncludeChanges = true,
SlotMode = false
};
foreach (var h in server.QueryHistory(queryParams))
{
Console.WriteLine(h.ChangesetId);
}
但是在输出中我只得到文件在当前位置的顶级变更集,而不是它被移动或分支的那些:
576909
552480
550006
我到处搜索,我读到的所有内容都让我看起来像是在调用正确的东西,但它就是行不通。
最佳答案
尝试以下操作: 12345 是您需要历史记录的变更集编号。
IEnumerable<Change> changes = vcs.GetChangesForChangeset(12345, false, Int32.MaxValue, null, null, true);
foreach (Change change in changes)
{
foreach (var m in change.MergeSources)
{
//m.VersionFrom;
//m.VersionTo;
}
}
关于c# - TFS 2012 API : How do I get all history for a file including renames and merges?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24835013/