Moe Sisko
Moe Sisko

Reputation: 12015

TFS API - Fetch latest two checkins for each file

I'm trying to fetch changeset metadata on the two most recent checkins for each of about 1000 files. The challenge is trying to do this in a reasonably efficient way.

Consider this overload of VersionControlServer.QueryHistory :

https://msdn.microsoft.com/en-us/library/ff736442(v=vs.100).aspx#

From observed behaviour, it seems that when sortAscending = false, that the result seems to be received in descending order of changeset id. If this was true, then I could call the method, setting maxCount = 2 for each file. This would get me meta data about the two most recent checkins for a file. (using maxCount = 0, and sorting the changesets on the client side may cause a lot of data to be pulled).

My question is, is my assumption about the sort order when maxCount = 2 and sortAscending = false safe to make ? The documentation says that when sortAscending = true, then it is sorted in ascending order, but when sortAscending = false, it's not so clear what happens.

Upvotes: 0

Views: 73

Answers (1)

Cece Dong - MSFT
Cece Dong - MSFT

Reputation: 31043

I don't use this method before, but according to this blog, blogger wanted to sort descending, then he made sortAscending = false:

// We want to sort descending
queryHistoryParameters.SortAscending = false;

Upvotes: 1

Related Questions