Enable the console show version command and the viewer about command, to show the last git commit hash together with the conmit date and time. The data is retrieved form a file bin/.version This file can be generated automatically using the post commit script by adding the following to the script:
git log -n 1 --pretty="format:%h: %ci" > bin/.version This command can also be run manually to create the bin/.version file. This command genrates a short form of the commit hash and a date and time of the commit in ISO8601 format. If a full commit hash is required then change %h to %H The logic that is used to extract the deprecated svn revision is still included. It will be removed at a future datearthursv
parent
39c9f681ab
commit
bb64906a9c
|
@ -43,3 +43,4 @@ OpenSim/OpenSim.usertasks
|
||||||
TAGS
|
TAGS
|
||||||
*~
|
*~
|
||||||
Makefile.local
|
Makefile.local
|
||||||
|
bin/.version
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace OpenSim.Framework.Servers
|
||||||
protected string m_startupDirectory = Environment.CurrentDirectory;
|
protected string m_startupDirectory = Environment.CurrentDirectory;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Server version information. Usually VersionInfo + information about svn revision, operating system, etc.
|
/// Server version information. Usually VersionInfo + information about git commit, operating system, etc.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected string m_version;
|
protected string m_version;
|
||||||
|
|
||||||
|
@ -422,6 +422,16 @@ namespace OpenSim.Framework.Servers
|
||||||
{
|
{
|
||||||
string buildVersion = string.Empty;
|
string buildVersion = string.Empty;
|
||||||
|
|
||||||
|
// Add commit hash and date information if available
|
||||||
|
// The commit hash and date are stored in a file bin/.version
|
||||||
|
// This file can automatically created by a post
|
||||||
|
// commit script in the opensim git master repository or
|
||||||
|
// by issuing the follwoing command from the top level
|
||||||
|
// directory of the opensim repository
|
||||||
|
// git log -n 1 --pretty="format:%h: %ci" >bin/.version
|
||||||
|
// For the full git commit hash use %H instead of %h
|
||||||
|
//
|
||||||
|
// The subversion information is deprecated and will be removed at a later date
|
||||||
// Add subversion revision information if available
|
// Add subversion revision information if available
|
||||||
// Try file "svn_revision" in the current directory first, then the .svn info.
|
// Try file "svn_revision" in the current directory first, then the .svn info.
|
||||||
// This allows to make the revision available in simulators not running from the source tree.
|
// This allows to make the revision available in simulators not running from the source tree.
|
||||||
|
@ -429,15 +439,28 @@ namespace OpenSim.Framework.Servers
|
||||||
// elsewhere as well
|
// elsewhere as well
|
||||||
string svnRevisionFileName = "svn_revision";
|
string svnRevisionFileName = "svn_revision";
|
||||||
string svnFileName = ".svn/entries";
|
string svnFileName = ".svn/entries";
|
||||||
|
string gitCommitFileName = ".version";
|
||||||
string inputLine;
|
string inputLine;
|
||||||
int strcmp;
|
int strcmp;
|
||||||
|
|
||||||
|
if (File.Exists( gitCommitFileName))
|
||||||
|
{
|
||||||
|
StreamReader CommitFile = File.OpenText(gitCommitFileName);
|
||||||
|
buildVersion = Environment.NewLine + "git# " + CommitFile.ReadLine();
|
||||||
|
CommitFile.Close();
|
||||||
|
m_version += buildVersion ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the else logic when subversion mirror is no longer used
|
||||||
|
else
|
||||||
|
{
|
||||||
if (File.Exists(svnRevisionFileName))
|
if (File.Exists(svnRevisionFileName))
|
||||||
{
|
{
|
||||||
StreamReader RevisionFile = File.OpenText(svnRevisionFileName);
|
StreamReader RevisionFile = File.OpenText(svnRevisionFileName);
|
||||||
buildVersion = RevisionFile.ReadLine();
|
buildVersion = RevisionFile.ReadLine();
|
||||||
buildVersion.Trim();
|
buildVersion.Trim();
|
||||||
RevisionFile.Close();
|
RevisionFile.Close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName))
|
if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName))
|
||||||
|
@ -463,6 +486,7 @@ namespace OpenSim.Framework.Servers
|
||||||
|
|
||||||
m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6);
|
m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void CreatePIDFile(string path)
|
protected void CreatePIDFile(string path)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue