diff --git a/src/Tgstation.Server.Host/Components/Chat/Commands/CommandFactory.cs b/src/Tgstation.Server.Host/Components/Chat/Commands/CommandFactory.cs
index 5f8acb3c5d..4841366c5a 100644
--- a/src/Tgstation.Server.Host/Components/Chat/Commands/CommandFactory.cs
+++ b/src/Tgstation.Server.Host/Components/Chat/Commands/CommandFactory.cs
@@ -77,6 +77,7 @@ namespace Tgstation.Server.Host.Components.Chat.Commands
{
new VersionCommand(application),
new ByondCommand(byondManager),
+ new RevisionCommand(watchdog, repositoryManager, instance),
new PullRequestsCommand(watchdog, repositoryManager, databaseContextFactory, instance),
new KekCommand()
};
diff --git a/src/Tgstation.Server.Host/Components/Chat/Commands/RevisionCommand.cs b/src/Tgstation.Server.Host/Components/Chat/Commands/RevisionCommand.cs
new file mode 100644
index 0000000000..4212c0459d
--- /dev/null
+++ b/src/Tgstation.Server.Host/Components/Chat/Commands/RevisionCommand.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Tgstation.Server.Host.Components.Repository;
+using Tgstation.Server.Host.Components.Watchdog;
+
+namespace Tgstation.Server.Host.Components.Chat.Commands
+{
+ ///
+ /// For displaying
+ ///
+ sealed class RevisionCommand : ICommand
+ {
+ ///
+ public string Name => "revision";
+
+ ///
+ public string HelpText => "Display live commit sha. Add --repo to view repository revision";
+
+ ///
+ public bool AdminOnly => false;
+
+ ///
+ /// The for the
+ ///
+ readonly IWatchdog watchdog;
+
+ ///
+ /// The for the
+ ///
+ readonly IRepositoryManager repositoryManager;
+
+ ///
+ /// The for the
+ ///
+ readonly Models.Instance instance;
+
+ ///
+ /// Construct a
+ ///
+ /// The value of
+ /// The value of
+ /// The value of
+ public RevisionCommand(IWatchdog watchdog, IRepositoryManager repositoryManager, Models.Instance instance)
+ {
+ this.watchdog = watchdog ?? throw new ArgumentNullException(nameof(watchdog));
+ this.repositoryManager = repositoryManager ?? throw new ArgumentNullException(nameof(repositoryManager));
+ this.instance = instance ?? throw new ArgumentNullException(nameof(instance));
+ }
+
+ ///
+ public async Task Invoke(string arguments, User user, CancellationToken cancellationToken)
+ {
+ string result;
+ if (arguments.Split(' ').Any(x => x.ToUpperInvariant() == "--REPO"))
+ using (var repo = await repositoryManager.LoadRepository(cancellationToken).ConfigureAwait(false))
+ {
+ if (repo == null)
+ return "Repository unavailable!";
+ result = repo.Head;
+ }
+ else
+ {
+ if (!watchdog.Running)
+ return "Server offline!";
+ result = watchdog.ActiveCompileJob?.RevisionInformation.CommitSha;
+ }
+
+ return String.Format(CultureInfo.InvariantCulture, "^{0}", result);
+ }
+ }
+}