문제

Given: TFS server with m > n changesets in team project X.

I am using TFS API and would like to get the n latest changesets of that branch.

I think I should be using VersionControlServer.QueryHistory, but I don't understand how I can specify that I want all commits from main (default) branch of project X, but none from any other branch or from another team project in the collection.

도움이 되었습니까?

해결책

If you only want changes in $/Project/Some/Path, then that should be the first argument to QueryHistory. For example:

QueryHistory("$/Project/Some/Path", RecursionType.Full, 5);

Will show the most recent 5 changesets that affected $/Project/Some/Path.

다른 팁

This worked for me - I had to use the QueryHistoryParameters overload and set SortAscending = false in order to get the latest changeset id and not the first changesetid.

var p = new QueryHistoryParameters(item.ServerItem, RecursionType.Full) {SortAscending = false};
var q = versionControl.QueryHistory(p);
var lastCs = q.FirstOrDefault();

if (lastCs != null)
    item.LastChangesetId = lastCs.ChangesetId;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top