diff --git a/TGS.ControlPanel/ControlPanel/ServerPage.cs b/TGS.ControlPanel/ControlPanel/ServerPage.cs index 412acb1ff3..55ae416434 100644 --- a/TGS.ControlPanel/ControlPanel/ServerPage.cs +++ b/TGS.ControlPanel/ControlPanel/ServerPage.cs @@ -327,9 +327,10 @@ namespace TGS.ControlPanel MessageBox.Show(res); return; } - + List> pullsRequests = null; - if(Program.GetRepositoryRemote(repo, out string remoteOwner, out string remoteName)) { + if (Program.GetRepositoryRemote(repo, out string remoteOwner, out string remoteName)) + { //find out which of the PRs have been merged pullsRequests = new List>(); foreach (var I in pulls) @@ -338,14 +339,14 @@ namespace TGS.ControlPanel res = await Task.Factory.StartNew(() => repo.Update(true)); - if(res != null) + if (res != null) { MessageBox.Show(res, "Error updating repository"); return; } await Task.Factory.StartNew(() => repo.GenerateChangelog(out res)); - + if (res != null) MessageBox.Show(res, "Error generating changelog"); @@ -361,22 +362,14 @@ namespace TGS.ControlPanel if (I.Result.Merged) pulls.RemoveAll(x => x.Number == I.Result.Number); - var results = new List(); - foreach (var I in pulls) { - retry: - await Task.Factory.StartNew(() => res = repo.MergePullRequest(I.Number, I.Sha, true)); - if (res != null) - switch(MessageBox.Show(res, "Error Re-merging Pull Request", MessageBoxButtons.AbortRetryIgnore)) - { - case DialogResult.Abort: - return; - case DialogResult.Retry: - goto retry; - } - } + var mergeResults = await Task.Factory.StartNew(() => repo.MergePullRequests(pulls, true)); + var compileStartResult = await Task.Factory.StartNew(() => Interface.GetComponent().Compile(true)); - await Task.Factory.StartNew(() => Interface.GetComponent().Compile(pulls.Count != 1)); - if (res != null) + foreach (var I in mergeResults) + if (I != null) + MessageBox.Show(res, "Error Re-merging Pull Request"); + + if (!compileStartResult) MessageBox.Show(res, "Error starting compile!"); } finally diff --git a/TGS.ControlPanel/TestMergeManager.cs b/TGS.ControlPanel/TestMergeManager.cs index bb7ec6776f..ea497fa5af 100644 --- a/TGS.ControlPanel/TestMergeManager.cs +++ b/TGS.ControlPanel/TestMergeManager.cs @@ -238,7 +238,7 @@ namespace TGS.ControlPanel try { //so first collect a list of pulls that are checked - var pulls = new Dictionary(); + var pulls = new List(); foreach (var I in PullRequestListBox.CheckedItems) { var S = (string)I; @@ -249,7 +249,7 @@ namespace TGS.ControlPanel var key = Convert.ToInt32((splits[0].Substring(1))); try { - pulls.Add(key, mergedSha); + pulls.Add(new PullRequestInfo(key, mergedSha)); } catch { @@ -276,28 +276,17 @@ namespace TGS.ControlPanel if (UpdateToRemoteRadioButton.Checked) { GenerateChangelog(repo); - await WrapServerOp(() => error = repo.SynchronizePush()); - if (error != null) - MessageBox.Show(String.Format("Error sychronizing repo: {0}", error)); + error = await Task.Factory.StartNew(() => repo.SynchronizePush()); } //Merge the PRs, collect errors - IList errors = null; - await WrapServerOp(() => - { - errors = new List(); - foreach (var I in pulls) - { - var res = repo.MergePullRequest(I.Key, I.Value, true); - if (res != null) - errors.Add(String.Format("Error merging PR #{0}: {1}", I, res)); - } - }); + var errors = await Task.Factory.StartNew(() => repo.MergePullRequests(pulls, false)); //Show any errors foreach (var I in errors) MessageBox.Show(I); - if (errors.Count != 0) + + if (errors.Count() != 0) return; if (pulls.Count > 0) @@ -305,7 +294,12 @@ namespace TGS.ControlPanel GenerateChangelog(repo); //Start the compile - if (!currentInterface.GetComponent().Compile(pulls.Count == 1)) + var compileStarted = await Task.Factory.StartNew(() => currentInterface.GetComponent().Compile(pulls.Count == 1)); + + if (error != null) + MessageBox.Show(String.Format("Error sychronizing repo: {0}", error)); + + if (!compileStarted) MessageBox.Show("Could not start compilation!"); else MessageBox.Show("Test merges updated and compilation started!");