async private Task <MergeRequestRebaseResponse> rebaseAsync()
        {
            traceInformation("[AcceptMergeRequestForm] Starting Rebase operation...");
            disableProcessingTimer();
            try
            {
                IMergeRequestEditor editor = getEditor();
                if (editor == null)
                {
                    return(null);
                }

                return(await editor.Rebase(null));
            }
            finally
            {
                BeginInvoke(new Action(async() =>
                {
                    // Don't enable timer processing immediately to prevent flickering of Rebase state:
                    // a timer might bring us an outdated state of rebase_in_progress flag.
                    // This delay is a way to skip one timer occurrence.
                    await Task.Delay(mergeRequestUpdateInterval);
                    enableProcessingTimer();
                }), null);
                traceInformation("[AcceptMergeRequestForm] Rebase operation finished");
            }
        }
Beispiel #2
0
        private async Task editTrackedTimeAsync(MergeRequestKey mrk, DataCache dataCache)
        {
            IMergeRequestEditor editor     = _shortcuts.GetMergeRequestEditor(mrk);
            TimeSpan?           oldSpanOpt = dataCache?.TotalTimeCache?.GetTotalTime(mrk).Amount;

            if (!oldSpanOpt.HasValue)
            {
                return;
            }

            TimeSpan oldSpan = oldSpanOpt.Value;

            using (EditTimeForm form = new EditTimeForm(oldSpan))
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    TimeSpan newSpan  = form.TimeSpan;
                    bool     add      = newSpan > oldSpan;
                    TimeSpan diffTemp = add ? newSpan - oldSpan : oldSpan - newSpan;
                    TimeSpan diff     = new TimeSpan(diffTemp.Hours, diffTemp.Minutes, diffTemp.Seconds);
                    if (diff == TimeSpan.Zero || dataCache?.TotalTimeCache == null)
                    {
                        return;
                    }

                    try
                    {
                        await editor.AddTrackedTime(diff, add);
                    }
                    catch (TimeTrackingException ex)
                    {
                        string message = "Cannot edit total tracked time";
                        ExceptionHandlers.Handle(message, ex);
                        MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    updateTotalTime(mrk, dataCache);
                    addOperationRecord("Total spent time has been updated");

                    Trace.TraceInformation(String.Format("[MainForm] Total time for MR {0} (project {1}) changed to {2}",
                                                         mrk.IId, mrk.ProjectKey.ProjectName, diff.ToString()));
                }
            }
        }
Beispiel #3
0
        async private Task <MergeRequest> applyModification(UpdateMergeRequestParameters parameters)
        {
            stopProcessingTimer();
            try
            {
                IMergeRequestEditor editor = getEditor();
                if (editor == null)
                {
                    return(null);
                }

                return(await editor.ModifyMergeRequest(parameters));
            }
            finally
            {
                startProcessingTimer();
            }
        }
Beispiel #4
0
        async private Task <MergeRequestRebaseResponse> rebaseAsync()
        {
            stopProcessingTimer();
            try
            {
                IMergeRequestEditor editor = getEditor();
                if (editor == null)
                {
                    return(null);
                }

                return(await editor.Rebase(null));
            }
            finally
            {
                startProcessingTimer();
            }
        }
        async private Task <MergeRequest> applyModification(UpdateMergeRequestParameters parameters)
        {
            disableProcessingTimer();
            try
            {
                IMergeRequestEditor editor = getEditor();
                if (editor == null)
                {
                    return(null);
                }

                return(await editor.ModifyMergeRequest(parameters));
            }
            finally
            {
                enableProcessingTimer();
                traceInformation("[AcceptMergeRequestForm] Modification applied");
            }
        }
Beispiel #6
0
        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");
            }
        }