Pretty simple.
I have a working demo on my blog => http://geekswithblogs.net/TarunArora/archive/2011/06/26/tfs-2010-sdk-smart-merge-programmatically-create-your-own-merge.aspx
Edited
I am very sorry that I did not understand your question. What you are looking for is the ability to get changeetId based on a specific file path in TFS, and then be able to see the changed elements for this set of changes, and then be able to see the changes in the source code and know who the author is from this source change . Right?
If this is correct, can you do the following?
public static void GetMergeDetailsForChangeSet() { var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("Enter the url of team project")); var versionControl = tfs.GetService<VersionControlServer>(); var a = versionControl.GetChangeset(12322); VersionSpec changeSpec = new ChangesetVersionSpec(a.Changes[0].Item.ChangesetId); var changeSetDetails = a.Changes[0].Item.VersionControlServer.QueryMergesWithDetails( null, null, 0, a.Changes[0].Item.ServerItem, changeSpec, a.Changes[0].Item.DeletionId, changeSpec, changeSpec, RecursionType.Full); }
- My blog post shows how to get software changes from TFS
- Now that you have a set of changes, you can restore the modified file.
- In the above example, I get merge details with this set of changes. In your case you will have to use GetItems (String, VersionSpec, RecursionType, DeletedState, ItemType, Boolean)
- The changeet object has the "Owner" property, this will tell who the author of the change is.
- Now, if you want to select the details of the first set of changes in this list, you will need to access Item.VersionControlServer to see the details here http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol. client.item.versioncontrolserver.aspx
Does this help, can I provide more information?
NTN.
Cheers, Tarun
source share