From 69eeff0ff13632bf17d3ca7dbd3b325bfa4ef04d Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Thu, 30 Nov 2017 09:30:54 -0500 Subject: [PATCH] Add a silent option to MergePullRequest --- TGS.Interface/Components/Repository.cs | 3 ++- TGS.Server/Instance/Repository.cs | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/TGS.Interface/Components/Repository.cs b/TGS.Interface/Components/Repository.cs index f9a395a915..49738f15bf 100644 --- a/TGS.Interface/Components/Repository.cs +++ b/TGS.Interface/Components/Repository.cs @@ -93,9 +93,10 @@ namespace TGS.Interface.Components /// /// The github pull request number in the remote repository /// The SHA of the pull request to merge + /// Suppresses chat messages if /// on success, error message on failure [OperationContract] - string MergePullRequest(int PRnumber, string atSHA = null); + string MergePullRequest(int PRnumber, string atSHA = null, bool silent = false); /// /// Get the currently merged pull requests. Note that switching branches will delete this list and switching back won't restore it diff --git a/TGS.Server/Instance/Repository.cs b/TGS.Server/Instance/Repository.cs index f081c815dc..b3c6567e34 100644 --- a/TGS.Server/Instance/Repository.cs +++ b/TGS.Server/Instance/Repository.cs @@ -889,7 +889,7 @@ namespace TGS.Server } /// - public string MergePullRequest(int PRNumber, string atSHA) + public string MergePullRequest(int PRNumber, string atSHA, bool silent) { lock (RepoLock) { @@ -898,7 +898,8 @@ namespace TGS.Server var result = LoadRepo(); if (result != null) return result; - SendMessage(String.Format("REPO: Merging PR #{0}{1}...", PRNumber, atSHA != null ? String.Format(" at commit {0}", atSHA): ""), MessageType.DeveloperInfo); + if(!silent) + SendMessage(String.Format("REPO: Merging PR #{0}{1}...", PRNumber, atSHA != null ? String.Format(" at commit {0}", atSHA): ""), MessageType.DeveloperInfo); result = ResetNoLock(null); if (result != null) return result; @@ -928,7 +929,7 @@ namespace TGS.Server branch = Repo.Branches[LocalBranchName]; if (branch == null) { - SendMessage("REPO: PR could not be fetched. Does it exist?", MessageType.DeveloperInfo); + SendMessage(String.Format("REPO: PR {0}could not be fetched. Does it exist?", silent ? String.Format("#{0} ", PRNumber) : ""), MessageType.DeveloperInfo); return String.Format("PR #{0} could not be fetched. Does it exist?", PRNumber); }