/// <summary> /// Uploads the diff. /// </summary> /// <param name="reviewRequest">The review request.</param> /// <param name="arguments">The arguments.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">arguments</exception> /// <exception cref="ReviewBoardAuthenticationException"></exception> public async Task UploadDiffAsync(ReviewBoardReviewRequest reviewRequest, ReviewBoardArguments arguments) { if (reviewRequest == null) { throw new ArgumentNullException("reviewRequest"); } if (arguments == null) { throw new ArgumentNullException("arguments"); } if (!Login(arguments)) { throw new ReviewBoardAuthenticationException(); } await AddReviewDiffAsync(reviewRequest.Id, arguments.BaseDirectory, arguments.DiffFile).ConfigureAwait(false); reviewRequest.Summary = arguments.Summary; reviewRequest.Description = arguments.Description; reviewRequest.Groups = arguments.Group; reviewRequest.Public = true; reviewRequest.BugsClosed = arguments.Bugs; await UpdateReviewRequestAsync(reviewRequest).ConfigureAwait(false); }
private bool Login(ReviewBoardArguments arguments) { if (ReadCookies()) { return(true); } if (arguments.CredentialCallback == null) { return(false); } var credentials = arguments.CredentialCallback("Review Board login"); Client.Authenticator = new HttpBasicAuthenticator(credentials.Username, credentials.Password); return(true); }
/// <summary> /// Posts a new review request to review board. /// </summary> /// <param name="arguments">The arguments.</param> /// <returns> /// Response filled with good data. /// </returns> /// <exception cref="ReviewBoardException">Thrown if the review cannot be posted.</exception> public async Task<ReviewBoardResponse> PostToReviewBoardAsync(ReviewBoardArguments arguments) { if (!Login(arguments)) { throw new ReviewBoardAuthenticationException(); } var reviewRequest = await PostReviewDraftAsync(arguments.Repository).ConfigureAwait(false); if (reviewRequest == null) { throw new ReviewBoardException("Unable to post review!"); } return new ReviewBoardResponse { ReviewTicketId = reviewRequest.Id.ToString(CultureInfo.InvariantCulture), ReviewUrl = _clientUrl + @"r/" + reviewRequest.Id, ReviewRequest = reviewRequest }; }
/// <summary> /// Posts a new review request to review board. /// </summary> /// <param name="arguments">The arguments.</param> /// <returns> /// Response filled with good data. /// </returns> /// <exception cref="ReviewBoardException">Thrown if the review cannot be posted.</exception> public async Task <ReviewBoardResponse> PostToReviewBoardAsync(ReviewBoardArguments arguments) { if (!Login(arguments)) { throw new ReviewBoardAuthenticationException(); } var reviewRequest = await PostReviewDraftAsync(arguments.Repository).ConfigureAwait(false); if (reviewRequest == null) { throw new ReviewBoardException("Unable to post review!"); } return(new ReviewBoardResponse { ReviewTicketId = reviewRequest.Id.ToString(CultureInfo.InvariantCulture), ReviewUrl = _clientUrl + @"r/" + reviewRequest.Id, ReviewRequest = reviewRequest }); }
public async Task<ReviewBoardResponse> PostToReviewBoardAsync(ReviewBoardArguments arguments) { await Task.Delay(1000); arguments.CredentialCallback("Review Board login"); return new ReviewBoardResponse { ReviewTicketId = "121", ReviewUrl = "http://intra/reviewboard/121/" }; }
public async Task UploadDiffAsync(ReviewBoardReviewRequest reviewRequest, ReviewBoardArguments arguments) { await Task.Delay(2000).ConfigureAwait(false); }
private bool Login(ReviewBoardArguments arguments) { if (ReadCookies()) { return true; } if (arguments.CredentialCallback == null) { return false; } var credentials = arguments.CredentialCallback("Review Board login"); Client.Authenticator = new HttpBasicAuthenticator(credentials.Username, credentials.Password); return true; }