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/" }); }
/// <summary> /// Posts a review ticket to review board. /// </summary> /// <param name="summary">The review summary.</param> /// <param name="description">The review description.</param> /// <param name="bugs">The review fixed bugs.</param> /// <returns> /// True if posting to review board succeeds; otherwise, false. /// </returns> public async Task PostToReviewBoardAsync(string summary, string description, string bugs) { string filename = null; try { OnReport("Creating diff..."); filename = await _patchCreator.CreatePatchAsync(_subversionArguments); OnReport("Diff created. Creating review ticket..."); var arguments = new ReviewBoardArguments { CredentialCallback = CredentialCallback, Description = description, Group = _projectSettings.ReviewBoardGroup, BaseDirectory = FigureOutRepositoryPath(), Repository = _projectSettings.ReviewBoardRepositoryName, Summary = summary, Bugs = bugs, DiffFile = filename }; var response = await _reviewBoardHandler.PostToReviewBoardAsync(arguments).ConfigureAwait(false); OnCopyToClipboard(response.ReviewUrl); OnReport("Uploading diff..."); await _reviewBoardHandler.UploadDiffAsync(response.ReviewRequest, arguments).ConfigureAwait(false); OnReport("Diff uploaded..."); } catch (ReviewBoardAuthenticationException) { throw; } catch (ReviewBoardException) { throw; } catch (Exception ex) { Console.WriteLine(ex); throw; } finally { if (!String.IsNullOrEmpty(filename)) { try { File.Delete(filename); } catch (Exception ex) { Console.WriteLine("Failed to delete file '{0}': {1}", filename, ex); } } } }
public async Task UploadDiffAsync(ReviewBoardReviewRequest reviewRequest, ReviewBoardArguments arguments) { await Task.Delay(2000).ConfigureAwait(false); }