我正在尝试创建一个应用程序(VB.NET,Winform项目),它从工作项ID开始,获取所有变更集和相对于工作项的标签。
我尝试使用此代码获取所有数据:
Dim c As New VssCredentials()
Dim conn As New VssConnection(New Uri(URI_PROJECTS), c)
'get all changesets
Dim tfvcClient As TfvcHttpClient = conn.GetClient(Of TfvcHttpClient)
Dim changesetTemp As List(Of TfvcChangesetRef)
Dim changesetList As New List(Of TfvcChangesetRef)
Dim firstCycle As Boolean = True
Dim stopCycle As Boolean = False
Dim lastChangesetId As Integer = -1
While Not stopCycle
If Not firstCycle Then
Dim criteria As New TfvcChangesetSearchCriteria()
criteria.ToId = lastChangesetId
changesetTemp = tfvcClient.GetChangesetsAsync(project:=PROJ_NAME, top:=256, searchCriteria:=criteria).Result
criteria = Nothing
Else
firstCycle = False
changesetTemp = tfvcClient.GetChangesetsAsync(project:=PROJ_NAME, top:=256).Result
End If
If changesetTemp.Count > 0 Then
If lastChangesetId = -1 Then
changesetList.AddRange(changesetTemp)
Else
changesetList.AddRange(changesetTemp.GetRange(1, changesetTemp.Count - 1))
End If
lastChangesetId = changesetTemp.Last.ChangesetId
If changesetTemp.Count < 256 Then
stopCycle = True
End If
End If
End While
'get all work item linked to changesets
For i As Integer = 0 To changesetList.Count - 1
Dim changeset As TfvcChangeset = tfvcClient.GetChangesetAsync(changesetList(i).ChangesetId, top:=1, includeDetails:=False, includeWorkItems:=True).Result
Next
'get all labels linked to changesets
Dim req As New TfvcLabelRequestData
req.MaxItemCount = 2000
Dim tfvcLbl As List(Of TfvcLabelRef) = tfvcClient.GetLabelsAsync(project:=PROJ_NAME, requestData:=req, top:=2000).Result
Dim item(tfvcLbl.Count - 1) As TfvcItem
For i As Integer = 0 To tfvcLbl.Count - 1
item(i) = tfvcClient.GetLabelItemsAsync(tfvcLbl(i).Id).Result(0)
Next
一切正常,但软件非常慢,需要大约8分钟才能完成。
我怎样才能加快速度?目前我还没有找到更快的功能。