aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/BaseOpenSimServer.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs57
1 files changed, 40 insertions, 17 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 5c3cad4..64b9c3e 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -31,6 +31,7 @@ using System.Diagnostics;
31using System.IO; 31using System.IO;
32using System.Reflection; 32using System.Reflection;
33using System.Text; 33using System.Text;
34using System.Text.RegularExpressions;
34using System.Threading; 35using System.Threading;
35using System.Timers; 36using System.Timers;
36using log4net; 37using log4net;
@@ -124,7 +125,6 @@ namespace OpenSim.Framework.Servers
124 m_logFileAppender = appender; 125 m_logFileAppender = appender;
125 } 126 }
126 } 127 }
127
128 } 128 }
129 129
130 /// <summary> 130 /// <summary>
@@ -443,45 +443,68 @@ namespace OpenSim.Framework.Servers
443 { 443 {
444 string buildVersion = string.Empty; 444 string buildVersion = string.Empty;
445 445
446 // Add commit hash and date information if available
447 // The commit hash and date are stored in a file bin/.version
448 // This file can automatically created by a post
449 // commit script in the opensim git master repository or
450 // by issuing the follwoing command from the top level
451 // directory of the opensim repository
452 // git log -n 1 --pretty="format:%h: %ci" >bin/.version
453 // For the full git commit hash use %H instead of %h
454 //
455 // The subversion information is deprecated and will be removed at a later date 446 // The subversion information is deprecated and will be removed at a later date
456 // Add subversion revision information if available 447 // Add subversion revision information if available
457 // Try file "svn_revision" in the current directory first, then the .svn info. 448 // Try file "svn_revision" in the current directory first, then the .svn info.
458 // This allows to make the revision available in simulators not running from the source tree. 449 // This allows to make the revision available in simulators not running from the source tree.
459 // FIXME: Making an assumption about the directory we're currently in - we do this all over the place 450 // FIXME: Making an assumption about the directory we're currently in - we do this all over the place
460 // elsewhere as well 451 // elsewhere as well
452 string gitDir = "../.git/";
453 string gitRefPointerPath = gitDir + "HEAD";
454
461 string svnRevisionFileName = "svn_revision"; 455 string svnRevisionFileName = "svn_revision";
462 string svnFileName = ".svn/entries"; 456 string svnFileName = ".svn/entries";
463 string gitCommitFileName = ".version"; 457 string manualVersionFileName = ".version";
464 string inputLine; 458 string inputLine;
465 int strcmp; 459 int strcmp;
466 460
467 if (File.Exists(gitCommitFileName)) 461 if (File.Exists(manualVersionFileName))
468 { 462 {
469 StreamReader CommitFile = File.OpenText(gitCommitFileName); 463 using (StreamReader CommitFile = File.OpenText(manualVersionFileName))
470 buildVersion = CommitFile.ReadLine(); 464 buildVersion = CommitFile.ReadLine();
471 CommitFile.Close(); 465
472 m_version += buildVersion ?? ""; 466 m_version += buildVersion ?? "";
473 } 467 }
468 else if (File.Exists(gitRefPointerPath))
469 {
470// m_log.DebugFormat("[OPENSIM]: Found {0}", gitRefPointerPath);
471
472 string rawPointer = "";
473
474 using (StreamReader pointerFile = File.OpenText(gitRefPointerPath))
475 rawPointer = pointerFile.ReadLine();
476
477// m_log.DebugFormat("[OPENSIM]: rawPointer [{0}]", rawPointer);
478
479 Match m = Regex.Match(rawPointer, "^ref: (.+)$");
480
481 if (m.Success)
482 {
483// m_log.DebugFormat("[OPENSIM]: Matched [{0}]", m.Groups[1].Value);
484
485 string gitRef = m.Groups[1].Value;
486 string gitRefPath = gitDir + gitRef;
487 if (File.Exists(gitRefPath))
488 {
489// m_log.DebugFormat("[OPENSIM]: Found gitRefPath [{0}]", gitRefPath);
474 490
475 // Remove the else logic when subversion mirror is no longer used 491 using (StreamReader refFile = File.OpenText(gitRefPath))
492 {
493 string gitHash = refFile.ReadLine();
494 m_version += gitHash.Substring(0, 7);
495 }
496 }
497 }
498 }
476 else 499 else
477 { 500 {
501 // Remove the else logic when subversion mirror is no longer used
478 if (File.Exists(svnRevisionFileName)) 502 if (File.Exists(svnRevisionFileName))
479 { 503 {
480 StreamReader RevisionFile = File.OpenText(svnRevisionFileName); 504 StreamReader RevisionFile = File.OpenText(svnRevisionFileName);
481 buildVersion = RevisionFile.ReadLine(); 505 buildVersion = RevisionFile.ReadLine();
482 buildVersion.Trim(); 506 buildVersion.Trim();
483 RevisionFile.Close(); 507 RevisionFile.Close();
484
485 } 508 }
486 509
487 if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName)) 510 if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName))