Exemplo n.º 1
0
        async private Task applyChangesToMergeRequestAsync(string hostname, User currentUser, FullMergeRequestKey item)
        {
            MergeRequestKey mrk      = new MergeRequestKey(item.ProjectKey, item.MergeRequest.IId);
            string          noteText = await MergeRequestEditHelper.GetLatestSpecialNote(_liveDataCache.DiscussionCache, mrk);

            MergeRequestPropertiesForm form = new EditMergeRequestPropertiesForm(hostname,
                                                                                 getProjectAccessor(), currentUser, item.ProjectKey, item.MergeRequest, noteText);

            if (form.ShowDialog() != DialogResult.OK)
            {
                Trace.TraceInformation("[MainForm] User declined to modify a merge request");
                return;
            }

            ApplyMergeRequestChangesParameters parameters =
                new ApplyMergeRequestChangesParameters(form.Title, form.AssigneeUsername,
                                                       form.Description, form.TargetBranch, form.DeleteSourceBranch, form.Squash);

            GitLabInstance gitLabInstance = new GitLabInstance(hostname, Program.Settings);
            bool           modified       = await MergeRequestEditHelper.ApplyChangesToMergeRequest(gitLabInstance, _modificationNotifier,
                                                                                                    item.ProjectKey, item.MergeRequest, parameters, noteText, form.SpecialNote, currentUser);

            string statusMessage = modified
            ? String.Format("Merge Request !{0} has been modified", mrk.IId)
            : String.Format("No changes have been made to Merge Request !{0}", mrk.IId);

            labelWorkflowStatus.Text = statusMessage;
            Trace.TraceInformation("[MainForm] {0}", statusMessage);

            if (modified)
            {
                requestUpdates(mrk,
                               new int[] {
                    100,
                    Program.Settings.OneShotUpdateFirstChanceDelayMs,
                    Program.Settings.OneShotUpdateSecondChanceDelayMs
                });
            }
        }
Exemplo n.º 2
0
        async private Task applyChangesToMergeRequestAsync(DataCache dataCache, string hostname, User currentUser,
                                                           FullMergeRequestKey item, IEnumerable <User> fullUserList)
        {
            MergeRequestKey mrk      = new MergeRequestKey(item.ProjectKey, item.MergeRequest.IId);
            string          noteText = await MergeRequestEditHelper.GetLatestSpecialNote(dataCache.DiscussionCache, mrk);

            MergeRequestPropertiesForm form = new EditMergeRequestPropertiesForm(hostname,
                                                                                 _shortcuts.GetProjectAccessor(), currentUser, item.ProjectKey, item.MergeRequest, noteText, fullUserList);

            if (form.ShowDialog() != DialogResult.OK)
            {
                Trace.TraceInformation("[MainForm] User declined to modify a merge request");
                return;
            }

            ApplyMergeRequestChangesParameters parameters =
                new ApplyMergeRequestChangesParameters(form.Title, form.AssigneeUsername,
                                                       form.Description, form.TargetBranch, form.DeleteSourceBranch, form.Squash,
                                                       form.IsHighPriority);

            bool modified = await MergeRequestEditHelper.ApplyChangesToMergeRequest(
                item.ProjectKey, item.MergeRequest, parameters, noteText, form.SpecialNote, currentUser,
                _shortcuts);

            string statusMessage = modified
            ? String.Format("Merge Request !{0} has been modified", mrk.IId)
            : String.Format("No changes have been made to Merge Request !{0}", mrk.IId);

            addOperationRecord(statusMessage);

            if (modified)
            {
                requestUpdates(EDataCacheType.Live, mrk, new int[] {
                    Program.Settings.OneShotUpdateFirstChanceDelayMs,
                    Program.Settings.OneShotUpdateSecondChanceDelayMs
                });
            }
        }