APIを使用して新しいブランチを作成しようとしていますが、との両方を使用していPendBranch()
ますCreateBranch()
。問題CreateBranch()
は、すぐにコミットし、ブランチがチェックインされたときにコメントを追加できるようにすることです。そこで、私が行ったことを以下に示します。
基本的に、マップするサーバーアイテムやローカルアイテムなどのすべての情報と、ブランチのソースとターゲットをWindowsアプリケーションから取得します。
どういうわけか、ソース管理エクスプローラーを表示すると、ワークスペースの作成後に:を指定したにもかかわらず、「マップされていません」と表示されます。workspace.Get()
workspace.Map(serverItem,localItem)
誰かがこれに光を当てることができますか?
public void CreateNewBranch(string server,string serverItem,string localItem,string sourceBranch, string targetBranch)
{
int changeSetNumber = 0;
// Get a reference to Team Foundation Server and Source Control.
tfs = GetTFS(server);
// Create a new workspace for the currently authenticated user.
workspace = tfvc.CreateWorkspace("Example Workspace", tfvc.AuthenticatedUser);
}
// Create a mapping to the project.
try
{
workspace.Map(serverItem, localItem);
// Get the latest source files from the repository.
//workspace.Get();
// Perform a pending Branch operation.
workspace.PendBranch(sourceBranch, targetBranch, VersionSpec.Latest);
// Get a list of all the Pending Changes.
PendingChange[] pendingChanges = workspace.GetPendingChanges();
if (pendingChanges.Length > 0)
{
changeSetNumber = workspace.CheckIn(pendingChanges, "Comment:Branch Created");
MessageBox.Show("Checked in changeset # " + changeSetNumber);
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
finally
{
// Cleanup the workspace.
workspace.Delete();
}
}