diff options
author | Chris Down | 2009-08-10 15:14:29 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2009-08-11 17:09:35 +0100 |
commit | bb64906a9cc891d9cc439bd2eda6ebf726364ca0 (patch) | |
tree | fa101451ab1a72ee2a520f4a69f7098e18d612c4 | |
parent | re-enable just TestReplicateArchivePathToUserInventory() for now to find out ... (diff) | |
download | opensim-SC_OLD-bb64906a9cc891d9cc439bd2eda6ebf726364ca0.zip opensim-SC_OLD-bb64906a9cc891d9cc439bd2eda6ebf726364ca0.tar.gz opensim-SC_OLD-bb64906a9cc891d9cc439bd2eda6ebf726364ca0.tar.bz2 opensim-SC_OLD-bb64906a9cc891d9cc439bd2eda6ebf726364ca0.tar.xz |
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 date
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 68 |
2 files changed, 47 insertions, 22 deletions
@@ -43,3 +43,4 @@ OpenSim/OpenSim.usertasks | |||
43 | TAGS | 43 | TAGS |
44 | *~ | 44 | *~ |
45 | Makefile.local | 45 | Makefile.local |
46 | bin/.version | ||
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index d2193ca..2a97528 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -76,7 +76,7 @@ namespace OpenSim.Framework.Servers | |||
76 | protected string m_startupDirectory = Environment.CurrentDirectory; | 76 | protected string m_startupDirectory = Environment.CurrentDirectory; |
77 | 77 | ||
78 | /// <summary> | 78 | /// <summary> |
79 | /// Server version information. Usually VersionInfo + information about svn revision, operating system, etc. | 79 | /// Server version information. Usually VersionInfo + information about git commit, operating system, etc. |
80 | /// </summary> | 80 | /// </summary> |
81 | protected string m_version; | 81 | protected string m_version; |
82 | 82 | ||
@@ -422,6 +422,16 @@ namespace OpenSim.Framework.Servers | |||
422 | { | 422 | { |
423 | string buildVersion = string.Empty; | 423 | string buildVersion = string.Empty; |
424 | 424 | ||
425 | // Add commit hash and date information if available | ||
426 | // The commit hash and date are stored in a file bin/.version | ||
427 | // This file can automatically created by a post | ||
428 | // commit script in the opensim git master repository or | ||
429 | // by issuing the follwoing command from the top level | ||
430 | // directory of the opensim repository | ||
431 | // git log -n 1 --pretty="format:%h: %ci" >bin/.version | ||
432 | // For the full git commit hash use %H instead of %h | ||
433 | // | ||
434 | // The subversion information is deprecated and will be removed at a later date | ||
425 | // Add subversion revision information if available | 435 | // Add subversion revision information if available |
426 | // Try file "svn_revision" in the current directory first, then the .svn info. | 436 | // Try file "svn_revision" in the current directory first, then the .svn info. |
427 | // This allows to make the revision available in simulators not running from the source tree. | 437 | // This allows to make the revision available in simulators not running from the source tree. |
@@ -429,39 +439,53 @@ namespace OpenSim.Framework.Servers | |||
429 | // elsewhere as well | 439 | // elsewhere as well |
430 | string svnRevisionFileName = "svn_revision"; | 440 | string svnRevisionFileName = "svn_revision"; |
431 | string svnFileName = ".svn/entries"; | 441 | string svnFileName = ".svn/entries"; |
442 | string gitCommitFileName = ".version"; | ||
432 | string inputLine; | 443 | string inputLine; |
433 | int strcmp; | 444 | int strcmp; |
434 | 445 | ||
435 | if (File.Exists(svnRevisionFileName)) | 446 | if (File.Exists( gitCommitFileName)) |
436 | { | 447 | { |
437 | StreamReader RevisionFile = File.OpenText(svnRevisionFileName); | 448 | StreamReader CommitFile = File.OpenText(gitCommitFileName); |
438 | buildVersion = RevisionFile.ReadLine(); | 449 | buildVersion = Environment.NewLine + "git# " + CommitFile.ReadLine(); |
439 | buildVersion.Trim(); | 450 | CommitFile.Close(); |
440 | RevisionFile.Close(); | 451 | m_version += buildVersion ?? ""; |
441 | } | 452 | } |
442 | 453 | ||
443 | if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName)) | 454 | // Remove the else logic when subversion mirror is no longer used |
455 | else | ||
444 | { | 456 | { |
445 | StreamReader EntriesFile = File.OpenText(svnFileName); | 457 | if (File.Exists(svnRevisionFileName)) |
446 | inputLine = EntriesFile.ReadLine(); | ||
447 | while (inputLine != null) | ||
448 | { | 458 | { |
449 | // using the dir svn revision at the top of entries file | 459 | StreamReader RevisionFile = File.OpenText(svnRevisionFileName); |
450 | strcmp = String.Compare(inputLine, "dir"); | 460 | buildVersion = RevisionFile.ReadLine(); |
451 | if (strcmp == 0) | 461 | buildVersion.Trim(); |
452 | { | 462 | RevisionFile.Close(); |
453 | buildVersion = EntriesFile.ReadLine(); | 463 | |
454 | break; | 464 | } |
455 | } | 465 | |
456 | else | 466 | if (string.IsNullOrEmpty(buildVersion) && File.Exists(svnFileName)) |
467 | { | ||
468 | StreamReader EntriesFile = File.OpenText(svnFileName); | ||
469 | inputLine = EntriesFile.ReadLine(); | ||
470 | while (inputLine != null) | ||
457 | { | 471 | { |
458 | inputLine = EntriesFile.ReadLine(); | 472 | // using the dir svn revision at the top of entries file |
473 | strcmp = String.Compare(inputLine, "dir"); | ||
474 | if (strcmp == 0) | ||
475 | { | ||
476 | buildVersion = EntriesFile.ReadLine(); | ||
477 | break; | ||
478 | } | ||
479 | else | ||
480 | { | ||
481 | inputLine = EntriesFile.ReadLine(); | ||
482 | } | ||
459 | } | 483 | } |
484 | EntriesFile.Close(); | ||
460 | } | 485 | } |
461 | EntriesFile.Close(); | ||
462 | } | ||
463 | 486 | ||
464 | m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6); | 487 | m_version += string.IsNullOrEmpty(buildVersion) ? " " : ("." + buildVersion + " ").Substring(0, 6); |
488 | } | ||
465 | } | 489 | } |
466 | 490 | ||
467 | protected void CreatePIDFile(string path) | 491 | protected void CreatePIDFile(string path) |