Search code examples
azure-devopstfvc

How to do a merge using Azure DevOps Services .NET SDK and TfvcHttpClient


I want to merge a changeset from one TF branch to another using Azure DevOps Services .NET SDK and TfvcHttpClient. Simply put, I wish to replicate this behaviour using the "Azure DevOps Services .NET SDK" instead of using tf.exe:

c:\projects>tf merge /version:C137~C137 branch1 branch2 /recursive

I can already successfully load branches using this:

TfvcBranch branch1 = tfvcHttpClient.GetBranchAsync(project: "A Project", path: "$/branch1").Result;
TfvcBranch branch2 = tfvcHttpClient.GetBranchAsync(project: "A Project", path: "$/branch2").Result;

and I can successfully load changesets using this:

TfvcChangeset changeset = tfvcHttpClient.GetChangesetAsync(137).Result;

Just the missing part of the puzzle is how to merge the changeset 137 from branch1 to branch2.

Please Note: before locking this down as a duplicate, the source control is on a TFS server, not GIT, so can't use GitHttpClient or Pull Requests.


Solution

  • There are no REST API methods that allow you to perform TFVC merges.

    You will have to use the older SOAP-based ExtendedClient package or rely on the tf.