在 TFS API (TFS 2008、VS 2012) 中获取分支和合并历史记录

本文关键字:TFS 分支 获取 历史 记录 合并 2012 API 2008 VS | 更新日期: 2023-09-27 18:33:02

我使用 VS 2012、Microsoft.TeamFoundation.Client.dll 11.0 (TFS API) 和服务器 TFS 2008

我已创建分支

int changesetId = vcServer.CreateBranch(sourcePath, targetPath, VersionSpec.Latest);
Changeset changeset = vcServer.GetChangeset(changesetId);
            changeset.Comment = comment;
            changeset.Update();

我可以获取变更集列表

      var ChangesetList = vcServer.QueryHistory(targetPath,
              VersionSpec.Latest, 0, RecursionType.Full, "", versionFrom, VersionSpec.Latest,
              Int32.MaxValue,
              true, // the boolean "include changes" is taking the time... If you do not include the changes and only the metadata of the changesets the query is very fast
              false).Cast<Changeset>();

我可以对 Branch 中的文件进行签出和签入,然后进行合并。

我很困惑如何获得有关分支历史(GetBranchHistory),合并历史(可能QueryMergesWithDetails)以及与QueryPendingSets的差异的良好信息。

在 TFS API (TFS 2008、VS 2012) 中获取分支和合并历史记录

我认为罗伯特的旧博客文章可能会对您有所帮助http://blogs.msdn.com/b/roberthorvick/archive/2006/02/04/524960.aspx如果没记错的话,我们在 TFS 2010 中添加了更好的 api,以支持更可靠的批注和分支可视化。至于 QueryPendingSets,它与分支历史无关。它为您提供了服务器上可能的挂起更改集。您也可以尝试Workspace.GetPendingChanges,但我需要知道细节以帮助:)