I'm retrieving tfvc changesets related to a WorkItem. My next step is that i want to check if they are merged to a specific branch. I don't find anything about how to do this in c#.
Today what i have is this:
using (var changeSetClient =
new TfvcHttpClient(_uri, _credentials))
{
foreach (var relation in wi.Relations.Where(r => r.Url.Contains("Changeset")))
{
var changeset = changeSetClient.GetChangesetAsync("Welfare_Research_2009", relation.Attributes["id"]).Result;
changeset.
}
}
return null;
}
I can also get the right TfvcBranch that i wanna know if it's merged to.
But how can i check if it's Merged? Much like how the "Track Changesets" functionality in Visual Studio.
According to your description, VersionControlServer.TrackMerges() is the API you want to use.
TrackMerges(array<Int32[], ItemIdentifier, array<ItemIdentifier[], ItemSpec)
Gets merges that occurred from a source item to a set of target items, for a list of source Changeset IDs.
In the sourceItem parameter, pass the root of the branch you want to track changes from. In the targetItems parameter, pass the root of the branches that you want to track the changeset to. Note, this will only work for branch roots that have a merge relationship. The best way to make sure that is true is to view the branch hierarchy and make the branches are directly related or related through some route.
Let's say you wanted to track a changeset from $/Proj/Main to $/Proj/Feature2 in a branch hierarchy like this:
$/Proj/Main $/Proj/Dev $/Proj/Feature2
Then you would want to pass $/Proj/Main in as your sourceItem and $/Proj/Dev AND $/Proj/Feature2 as targetItems.
More detail code and sample please refer this blog: TFS API - TRACK CHANGESET MERGE IN BRANCHES