I have a program that reads the lastest build and gets all the changesets from it. It is then possible to determine if the changset that I have it actually a merge, and where it was from.
Here's what I have:
List<IChangesetSummary> changeSets = InformationNodeConverters.GetAssociatedChangesets(build);
IEnumerable<Changeset> changesetDetails = changeSets.Select(x => versionControlServer.GetChangeset(x.ChangesetId));
// Determine is the first changeset was a merge
changesetDetails.First().IsMerge // How to check is the changeset is part of a merge?
UPDATE:
Following the answers so far I have updated
foreach (var cs in changesetDetails)
{
foreach (Change change in cs.Changes)
{
if ((change.ChangeType & ChangeType.Merge) == 0)
continue;
foreach(var m in change.MergeSources)
But MergeSources
is always empty.
You would need to interrogate the files am see if the operation was "merge".
Use the
VersionControlServer.GetChangesForChangeset
method instead. The last parameter indicates that merge source information should be included.You need to check whether any of the
Changes
made inside aChangeset
is of the ChangeTypeMerge
.I don't know if the following works, but you get the idea:
Use the overload of
VersionControlServer.GetChangeset
that accepts theincludeDownloadInfo
bool parameter. Setting this parameter totrue
will include theMergeSources
in the returned changesets.[ https://msdn.microsoft.com/en-us/library/bb138628.aspx ]