public void Execute(ProcessorContext context) { Console.WriteLine("Extracting pull requests..."); var maxPullRequestId = GetMaxPullRequestId(context); int processed; var skip = 0; do { Uri url = TfsUrlTemplates.PullRequestsUri(PullRequestStatus.All, skip); string content = context.TfsRepository.DownloadString(url); context.Statistics.NumberHttpRequests++; JObject response = JsonConvert.DeserializeObject <JObject>(content); JArray pullRequests = (JArray)response["value"]; processed = 0; foreach (JToken pullRequest in pullRequests) { var pullRequestId = (int)pullRequest["pullRequestId"]; if (pullRequestId <= maxPullRequestId) { break; } processed++; context.Source.PullRequestArray.Insert(0, pullRequest); } skip += processed; }while (processed > 0); }
public void Execute(ProcessorContext context) { if (context.Source.WorkItemsUnique.Count == 0) { return; } Console.WriteLine("Extracting work items..."); foreach (int workItemId in context.Source.WorkItemsUnique) { Uri url = TfsUrlTemplates.WorkItemUri(workItemId); string content = context.TfsRepository.DownloadString(url); context.Statistics.NumberHttpRequests++; JToken response = JsonConvert.DeserializeObject <JObject>(content); context.Source.WorkItemArray.Add(response); } }
private static void ProcessLinks(ProcessorContext context, int pullRequestId) { Uri url = TfsUrlTemplates.PullRequestWorkItemsUri(pullRequestId); string content = context.TfsRepository.DownloadString(url); context.Statistics.NumberHttpRequests++; JObject response = JsonConvert.DeserializeObject <JObject>(content); JArray workItems = (JArray)response["value"]; foreach (JToken workItem in workItems) { var link = new Link { PullRequestId = pullRequestId, WorkItemId = (int)workItem["id"] }; context.Target.LinkList.Add(link); context.Source.WorkItemsUnique.Add(link.WorkItemId); } }