Skip to content

Commit

Permalink
Fix issue #2044 - PRCA has been broken by client OM changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan Gavril committed Jul 11, 2016
1 parent a3bbd06 commit 6e28f87
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
43 changes: 23 additions & 20 deletions Tasks/SonarQubePostTest/PRCA/PostComments-Server.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
function InitPostCommentsModule
{
param ([Microsoft.VisualStudio.Services.Client.VssConnection][ValidateNotNull()]$vssConnection)
param ([ValidateNotNull()]$vssConnection)

Write-Verbose "Initializing the PostComments-Module"

Expand Down Expand Up @@ -95,6 +95,7 @@ function LoadTfsClientAssemblies
$source = @"
using Microsoft.VisualStudio.Services.CodeReview.Discussion.WebApi;
using Microsoft.VisualStudio.Services.CodeReview.WebApi;
using Microsoft.TeamFoundation.SourceControl.WebApi;
using System;
using System.Collections.Generic;
Expand All @@ -119,6 +120,16 @@ namespace PsWorkarounds
{
return discussionClient.GetCommentsAsync(discussionId).Result;
}
public static IterationChanges GetChanges(CodeReviewHttpClient codeReviewClient, Guid teamProjectId, int codeReviewId, int iterationId)
{
return codeReviewClient.GetChangesAsync(teamProjectId, codeReviewId, iterationId).Result;
}
public static Review GetReview(CodeReviewHttpClient codeReviewClient, Guid teamProjectId, int codeReviewId)
{
return codeReviewClient.GetReviewAsync(teamProjectId, codeReviewId).Result;
}
}
}
"@
Expand Down Expand Up @@ -276,15 +287,11 @@ function ThreadMatchesCommentSource

function GetCodeFlowLatestIterationId
{
$review = $script:codeReviewClient.GetReviewAsync(
$script:pullRequest.Repository.ProjectReference.Id, # Guid project
$script:pullRequest.CodeReviewId, # int reviewId
$null, # bool? includeAllProperties
$null, # int? maxChangesCount
$null, # DateTimeOffset? ifModifiedSince
$null, # object userState
[System.Threading.CancellationToken]::None).Result

$review = [PsWorkarounds.Helper]::GetReview(
$script:codeReviewClient,
$script:pullRequest.Repository.ProjectReference.Id,
$script:pullRequest.CodeReviewId);

Assert ($review -ne $null) "Could not retrieve the review"
Assert (HasElements $review.Iterations) "No iterations found on the review"

Expand All @@ -297,11 +304,11 @@ function GetCodeFlowChanges
{
param ([int]$iterationId)

$changes = $script:codeReviewClient.GetChangesAsync(
$script:pullRequest.Repository.ProjectReference.Id,
$script:pullRequest.CodeReviewId,
$iterationId,
$null, $null, $null, [System.Threading.CancellationToken]::None).Result
$changes = [PsWorkarounds.Helper]::GetChanges(
$script:codeReviewClient,
$script:pullRequest.Repository.ProjectReference.Id,
$script:pullRequest.CodeReviewId,
$iterationId);

Write-Verbose "Change count: $($changes.Count)"

Expand All @@ -320,8 +327,4 @@ function GetCodeFlowChangeTrackingId
return $change.ChangeTrackingId
}

#endregion




#endregion
2 changes: 1 addition & 1 deletion Tasks/SonarQubePostTest/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 50
"Patch": 51
},
"minimumAgentVersion": "1.99.0",
"demands": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/SonarQubePostTest/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 50
"Patch": 51
},
"minimumAgentVersion": "1.99.0",
"demands": [
Expand Down

0 comments on commit 6e28f87

Please sign in to comment.