作为更大实现的一部分,我尝试使用 TFS-SDK 实现源代码控制分支/文件夹的合并操作。我正在针对 TFS2010 安装进行工作。
我所拥有的是这样的:
using System;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
using Microsoft.TeamFoundation.VersionControl.Common;
namespace MergeBranchesFolders
{
class Program
{
static void Main()
{
TfsTeamProjectCollection teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://TFSSERVER/Collection"));
var versionControl = teamProjectCollection.GetService<VersionControlServer>();
const string fromPath = "$/TeamProject/SourceDir";
const string toPath = "$/TeamProject/TargetDir";
Workspace myWorkspace = versionControl.GetWorkspace("WorkspaceName", "WorkspaceOwner");
GetStatus getStatus = myWorkspace.Merge(fromPath, toPath, VersionSpec.Latest, VersionSpec.Latest,
LockLevel.None, RecursionType.Full, MergeOptionsEx.None);
}
}
}
I'm convinced that I get proper access to myWorkspace
, yet the getStatus
looks like this:
That pretty much says that nothing has happened.
Yet if I try to merge in the IDE, I get several merge candidates.
The same merge candidates are also visible if I do a:
var mergeCandidates = versionControl.GetMergeCandidates(fromPath, toPath,RecursionType.Full).ToList();
我都失败了fromPath
/toPath
是分支和文件夹 - 即使是单个文件。
我能找到的唯一资源是this http://social.msdn.microsoft.com/forums/en-US/tfsversioncontrol/thread/5c0dedfa-8c4d-4fc6-bf78-23d20a2a4db0一个,这没有帮助......