From 5afe6c3ed97b1b04013f564e144e96ba07674107 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 7 May 2008 16:48:29 +0000 Subject: From: Kurt Taylor Implements the show version command. If you type show version at the console, you will get the revision that opensim is running, assuming you have the .svn/entries file in your base directory (e.g. you are running from code extracted from our SVN repository) A patch to also send this to the client should follow shortly --- OpenSim/Region/Application/Application.cs | 2 - OpenSim/Region/Application/OpenSimMainConsole.cs | 53 ++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index bdce0f0..3a45f70 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -46,8 +46,6 @@ namespace OpenSim XmlConfigurator.Configure(); - Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); - Console.Write("Performing compatibility checks... "); string supported = String.Empty; if (Util.IsEnvironmentSupported(ref supported)) diff --git a/OpenSim/Region/Application/OpenSimMainConsole.cs b/OpenSim/Region/Application/OpenSimMainConsole.cs index b213ed2..ab835ba 100644 --- a/OpenSim/Region/Application/OpenSimMainConsole.cs +++ b/OpenSim/Region/Application/OpenSimMainConsole.cs @@ -55,7 +55,7 @@ namespace OpenSim private string m_timedScript = "disabled"; private Timer m_scriptTimer; - + private string buildVersion = null; public OpenSimMainConsole(IConfigSource configSource) : base(configSource) @@ -113,6 +113,41 @@ namespace OpenSim m_scriptTimer.Elapsed += RunAutoTimerScript; } PrintFileToConsole("startuplogo.txt"); + + // Set BuildVersion String for Show version command + string svnFileName = "../.svn/entries"; + string inputLine = null; + int strcmp; + + if (File.Exists(svnFileName)) + { + StreamReader EntriesFile = File.OpenText(svnFileName); + inputLine = EntriesFile.ReadLine(); + while (inputLine != null) + { + // using the dir svn revision at the top of entries file + strcmp = String.Compare(inputLine, "dir"); + if (strcmp == 0) + { + buildVersion = EntriesFile.ReadLine(); + break; + } + else + { + inputLine = EntriesFile.ReadLine(); + } + } + EntriesFile.Close(); + } + + if ((buildVersion != null) && (buildVersion.Length > 0)) + { + m_log.Info("OpenSim " + VersionInfo.Version + " r" + buildVersion + "\n"); + } + else + { + m_log.Info("OpenSim " + VersionInfo.Version + "\n"); + } } protected ConsoleBase CreateConsole() @@ -280,7 +315,8 @@ namespace OpenSim m_console.Notice("show assets - show state of asset cache."); m_console.Notice("show users - show info about connected users."); m_console.Notice("show modules - shows info about loaded modules."); - m_console.Notice("show stats - statistical information for this server not displayed in the client"); + m_console.Notice("show stats - statistical information for this server"); + m_console.Notice("show version - show the running build version."); m_console.Notice("threads - list threads"); m_console.Notice("config set section field value - set a config value"); m_console.Notice("config get section field - get a config value"); @@ -639,7 +675,18 @@ namespace OpenSim { m_console.Notice("Extra sim statistics collection has not been enabled"); } - break; + break; + + case "version": + if ((buildVersion != null) && (buildVersion.Length > 0)) + { + m_console.Notice("The build version is: r" + buildVersion); + } + else + { + m_console.Notice("The build version is not available"); + } + break; } } -- cgit v1.1