From a2d7b850bb9751d0c785069ae34e7cef5716c5b7 Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Thu, 22 Jun 2017 12:16:03 -0400 Subject: [PATCH] Brings update messages more inline with TGS2 --- TGServerService/Compiler.cs | 18 +++++++++++++++--- TGServerService/InterfaceBase.cs | 4 ++-- TGServerService/Repository.cs | 6 +++++- TGServiceInterface/Compiler.cs | 5 +++-- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/TGServerService/Compiler.cs b/TGServerService/Compiler.cs index ba8e0b5c0a..d3ba0218c7 100644 --- a/TGServerService/Compiler.cs +++ b/TGServerService/Compiler.cs @@ -48,6 +48,7 @@ namespace TGServerService Thread CompilerThread; bool compilationCancellationRequestation = false; bool canCancelCompilation = false; + bool silentCompile = false; //deletes leftovers and checks current status void InitCompiler() @@ -197,6 +198,7 @@ namespace TGServerService lock (CompilerLock) { compilerCurrentStatus = TGCompilerStatus.Compiling; + silentCompile = true; } } catch (ThreadAbortException) @@ -286,7 +288,16 @@ namespace TGServerService compilerCurrentStatus = TGCompilerStatus.Initialized; return; } - SendMessage("DM: Compiling..."); + bool silent; + lock (CompilerLock) + { + silent = silentCompile; + silentCompile = false; + } + + if(!silent) + SendMessage("DM: Compiling..."); + var resurrectee = GetStagingDir(); Program.DeleteDirectory(resurrectee, true, deleteExcludeList); @@ -491,7 +502,7 @@ namespace TGServerService { compilerCurrentStatus = TGCompilerStatus.Initialized; compilationCancellationRequestation = false; - SendMessage("Compile cancelled!"); + SendMessage("DM: Compile cancelled!"); TGServerService.WriteInfo("Compilation cancelled", TGServerService.EventID.DMCompileCancel); } } @@ -499,12 +510,13 @@ namespace TGServerService } //kicks off the compiler thread //public api - public bool Compile() + public bool Compile(bool silent = false) { lock (CompilerLock) { if (compilerCurrentStatus != TGCompilerStatus.Initialized) return false; + silentCompile = silent; lastCompilerError = null; compilerCurrentStatus = TGCompilerStatus.Compiling; CompilerThread = new Thread(new ThreadStart(CompileImpl)); diff --git a/TGServerService/InterfaceBase.cs b/TGServerService/InterfaceBase.cs index 24b89370e5..1b7d402bb6 100644 --- a/TGServerService/InterfaceBase.cs +++ b/TGServerService/InterfaceBase.cs @@ -56,7 +56,7 @@ namespace TGServerService if (testmerge_pr != 0) { - res = MergePullRequest(testmerge_pr); + res = MergePullRequestImpl(testmerge_pr, true); if (res != null && res != RepoErrorUpToDate) return res; } @@ -75,7 +75,7 @@ namespace TGServerService return res; } - if (!Compile()) + if (!Compile(true)) return "Compilation could not be started!"; return null; } diff --git a/TGServerService/Repository.cs b/TGServerService/Repository.cs index 90518dd157..8a1330afaa 100644 --- a/TGServerService/Repository.cs +++ b/TGServerService/Repository.cs @@ -506,13 +506,17 @@ namespace TGServerService //public api public string MergePullRequest(int PRNumber) + { + return MergePullRequestImpl(PRNumber, false); + } + string MergePullRequestImpl(int PRNumber, bool impliedUpdate) { lock (RepoLock) { var result = LoadRepo(); if (result != null) return result; - SendMessage(String.Format("REPO: Merging PR #{0}...", PRNumber)); + SendMessage(String.Format("REPO: {2}erging PR #{0}...", PRNumber, impliedUpdate ? "Test m" : "M")); try { //only supported with github diff --git a/TGServiceInterface/Compiler.cs b/TGServiceInterface/Compiler.cs index 434282bfcf..75684245fb 100644 --- a/TGServiceInterface/Compiler.cs +++ b/TGServiceInterface/Compiler.cs @@ -42,16 +42,17 @@ namespace TGServiceInterface /// true if the operation began, false if it could not start [OperationContract] bool Initialize(); - + /// /// Does all the necessary actions to take the revision currently in the repository /// and compile it to be run on the next server reboot /// requires byond to be set up and the compiler to be initialized /// runs asyncronously /// + /// If true no message for compilation start will be printed /// true if the operation began, false if it could not start [OperationContract] - bool Compile(); + bool Compile(bool silent = false); /// /// Cancels the current compilation