If you want to know, given a changeset number representing a changeset that contains merges, changes from which changesets are included, afaik you need to aks the TFS API. To make life easier for you, here is my solution:
var tfs = new TfsTeamProjectCollection(new Uri("http://yourServer:8080/tfs/DefaultCollection"));
tfs.EnsureAuthenticated();
var versionControl = tfs.GetService<VersionControlServer>();
var changeSet = versionControl.GetChangeset(3894);
var mergeParentChangesets = changeSet.Changes
.SelectMany(c => versionControl.QueryMergeRelationships(c.Item.ServerItem))
.Select(i => i.Version)
.Cast<ChangesetVersionSpec>()
.Select(i => i.ChangesetId)
.Distinct();
Here my changeset number is 3894. I iterate over all the changes in the changeset, asking for the merge relationships of each Change. I have to use SelectMany as QueryMergeRelationships returns an array of VersionSpec instances. Indeed, all these instances are truely ChangesetsVersionSpec objects, hence the cast. The latter object exposes the changeset id that we can collect in a distinct list.
Hope this helps, and happy merging!
Keine Kommentare:
Kommentar veröffentlichen