mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-26 22:48:20 +01:00
Make CP use MergePullRequests where applicable
This commit is contained in:
@@ -327,9 +327,10 @@ namespace TGS.ControlPanel
|
||||
MessageBox.Show(res);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
List<Task<PullRequest>> 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<Task<PullRequest>>();
|
||||
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<string>();
|
||||
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<ITGCompiler>().Compile(true));
|
||||
|
||||
await Task.Factory.StartNew(() => Interface.GetComponent<ITGCompiler>().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
|
||||
|
||||
Reference in New Issue
Block a user