internal Task <MergeRequest> AcceptMergeRequest(MergeRequestKey mrk, AcceptMergeRequestParameters parameters) { return(callWithSharedClient( async(client) => await OperatorCallWrapper.Call( async() => (MergeRequest)(await client.RunAsync( async(gl) => await gl.Projects.Get(mrk.ProjectKey.ProjectName).MergeRequests.Get(mrk.IId) .AcceptMergeRequestTaskAsync(parameters)))))); }
async private Task <MergeRequest> mergeAsync(string squashCommitMessage, bool shouldRemoveSourceBranch) { AcceptMergeRequestParameters parameters = new AcceptMergeRequestParameters( null, squashCommitMessage, null, shouldRemoveSourceBranch, null, null); stopProcessingTimer(); try { IMergeRequestEditor editor = getEditor(); if (editor == null) { return(null); } return(await editor.Merge(parameters)); } finally { startProcessingTimer(); } }
async private Task <MergeRequest> mergeAsync(string squashCommitMessage, bool shouldRemoveSourceBranch) { AcceptMergeRequestParameters parameters = new AcceptMergeRequestParameters( null, squashCommitMessage, null, shouldRemoveSourceBranch, null, null); traceInformation("[AcceptMergeRequestForm] Starting Merge operation..."); disableProcessingTimer(); try { IMergeRequestEditor editor = getEditor(); if (editor == null) { return(null); } return(await editor.Merge(parameters)); } finally { enableProcessingTimer(); traceInformation("[AcceptMergeRequestForm] Merge operation finished"); } }
async public Task <MergeRequest> Merge(AcceptMergeRequestParameters parameters) { using (MergeRequestOperator mergeRequestOperator = new MergeRequestOperator( _mrk.ProjectKey.HostName, _hostProperties)) { try { return(await mergeRequestOperator.AcceptMergeRequest(_mrk, parameters)); } catch (OperatorException ex) { if (ex.Cancelled) { throw new MergeRequestEditorCancelledException(); } if (ex.InnerException is GitLabRequestException glx) { throw new MergeRequestEditorException("Cannot merge MR", glx); } throw new MergeRequestEditorException("Cannot merge MR by unknown reason", null); } } }