async private Task createNewMergeRequestAsync(SubmitNewMergeRequestParameters parameters, string firstNote)
        {
            buttonCreateNew.Enabled  = false;
            labelWorkflowStatus.Text = "Creating a merge request at GitLab...";

            GitLabInstance  gitLabInstance = new GitLabInstance(parameters.ProjectKey.HostName, Program.Settings);
            MergeRequestKey?mrkOpt         = await MergeRequestEditHelper.SubmitNewMergeRequestAsync(gitLabInstance,
                                                                                                     _modificationNotifier, parameters, firstNote, getCurrentUser());

            if (mrkOpt == null)
            {
                // all error handling is done at the callee side
                string message = "Merge Request has not been created";
                labelWorkflowStatus.Text = message;
                buttonCreateNew.Enabled  = true;
                Trace.TraceInformation("[MainForm] {0}", message);
                return;
            }

            requestUpdates(null, new int[] { Constants.NewOrClosedMergeRequestRefreshListTimerInterval });

            labelWorkflowStatus.Text = String.Format("Merge Request !{0} has been created in project {1}",
                                                     mrkOpt.Value.IId, parameters.ProjectKey.ProjectName);
            buttonCreateNew.Enabled = true;

            _newMergeRequestDialogStatesByHosts[getHostName()] = new NewMergeRequestProperties(
                parameters.ProjectKey.ProjectName, null, null, parameters.AssigneeUserName, parameters.Squash,
                parameters.DeleteSourceBranch);

            Trace.TraceInformation(
                "[MainForm] Created a new merge request. " +
                "Project: {0}, SourceBranch: {1}, TargetBranch: {2}, Assignee: {3}, firstNote: {4}",
                parameters.ProjectKey.ProjectName, parameters.SourceBranch, parameters.TargetBranch,
                parameters.AssigneeUserName, firstNote);
        }
Exemple #2
0
        async private Task createNewMergeRequestAsync(SubmitNewMergeRequestParameters parameters, string firstNote)
        {
            setMergeRequestEditEnabled(false);
            addOperationRecord("Creating a merge request at GitLab has started");

            MergeRequestKey?mrkOpt = await MergeRequestEditHelper.SubmitNewMergeRequestAsync(
                parameters, firstNote, getCurrentUser(), _shortcuts);

            if (mrkOpt == null)
            {
                // all error handling is done at the callee side
                string message = "Merge Request has not been created";
                addOperationRecord(message);
                setMergeRequestEditEnabled(true);
                return;
            }

            requestUpdates(EDataCacheType.Live, null, new int[] {
                Program.Settings.NewOrClosedMergeRequestRefreshListDelayMs
            });

            addOperationRecord(String.Format("Merge Request !{0} has been created in project {1}",
                                             mrkOpt.Value.IId, parameters.ProjectKey.ProjectName));
            setMergeRequestEditEnabled(true);

            _newMergeRequestDialogStatesByHosts[getHostName()] = new NewMergeRequestProperties(
                parameters.ProjectKey.ProjectName, null, null, parameters.AssigneeUserName, parameters.Squash,
                parameters.DeleteSourceBranch);
            saveState();

            Trace.TraceInformation(
                "[MainForm] Created a new merge request. " +
                "Project: {0}, SourceBranch: {1}, TargetBranch: {2}, Assignee: {3}, firstNote: {4}",
                parameters.ProjectKey.ProjectName, parameters.SourceBranch, parameters.TargetBranch,
                parameters.AssigneeUserName, firstNote);
        }