문제

Microsoft TFS client for VS 2010:

http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.item(v=vs.100).aspx

  • I (i.e., my code) have a Changeset.
  • I iterate to a particular Change.
  • I have an Item in the Change.

Now, I wish to get all Changesets that had Changes for that item.

Could someone advise me the best way to do that?

I could iterate thro all the Changesets of the branch concerned, which would be very inefficient.

도움이 되었습니까?

해결책

Edward is correct. And he has the credentials to back it up. (See his profile description) VersionControlServer.QueryHistory is the method you need to use. There are several ways to use it and I'm only describing one below which assumes that the server path of that item is what is important to you...

First, you need the server path of the Item:

string serverPath = Item.ServerItem;

Next, if you don't already have a VersionControlServer object instantiated, you can get one from your TeamProject like this:

VersionControlServer VCServer = (VersionControlServer)this.TeamProject.Store.TeamProjectCollection.GetService(typeof(VersionControlServer));

Use the VersionControlServer QueryHistory(string, boolean) method to get other changesets associated with that server path:

VCServer.QueryHistory(serverPath, false);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top