Show git version numbers - Windows

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Robot: Cosmetic changes)
 
(5 intermediate revisions by one user not shown)
Line 1: Line 1:
Two components are required to use this process.  
+
UPDATED: October.11.2010. The revtag.sh shell script
  
NOTE:  revtag.sh Updated October 03.2009
+
2 Methods are presented for resolving GIT Hash Numbers to generate the ".version" file in the BIN directory so that OpenSImulator can display version info. This aids in providing the version information for filing Mantis Reports and tracking the versions in use on the various simulators.  
  
'''1.''' The Batch File as presented
+
<br />
  
'''2.''' The revtag.sh shell script
+
== Usage: ==
  
Special Thanks to SMXY (shaun) @ OSGrid for the pointing me in the right direction with the shell script.  
+
1. Copy the Batch file to your desktop and edit the pathing to match your system.  
  
<br>'''Usage:'''
+
2. Create a revtag.sh in the git reposity, immediately above the bin folder. NOTE! if you perform a git clean this revtag.sh will be removed from the folder structure therefore you will have to copy it back in, I suggest you have a copy of it handy somewhere.
  
Copy the batch file to your desktop and edit the pathing to match your system.
+
For Example:
  
Copy the revtag.sh into the git reposity as commented in the batch file.&nbsp; NOTE! is you perform a&nbsp;git clean this revtag.sh will be removed form the folder structure therefore you will have to copy it back in, I&nbsp;suggest you have a copy of it handy somewhere.
+
/OpenSim_GIT
  
<br>
+
/OpenSim_GIT/opensim
  
'''The Batch File:'''&nbsp; GIT_Ver.bat<br>
+
/OpenSim_GIT/opensim/bin
<blockquote><br>echo off<br>::<br>:: FILENAME: GIT_Ver.bat<br>:: AUTHOR: WhiteStar Magic @ OSGrid<br>:: DATE: October.15.2009<br>:: REVISION: 0.2 (2nd release) corrected string info<br>::<br>:: DESCRIPTION: <br>:: - GENERATES Git# &amp; Revision Stamp for Opensim.<br>:: - creates the .version file in the /bin directory<br>:: - EXAMPLE: f42d085 - r10727 2009-09-16 15:06:08 -0700<br>::<br>:: INSTALLATION:<br>:: - place this on your desktop for easy access<br>:: - ensure that you have the CORRECT LOCATION defined in the OS_GIT_REPO variable below.<br>::&nbsp;!!! Example Structure as I use it. <br>:: C:\OpenSim_GIT &lt;--- Top Directory where the SH file is created<br>:: C:\OpenSim_GIT\bin &lt;--- where the bin directory is located<br>::&nbsp;!!! This must run from the ONE directory above where \bin is located&nbsp;!!!<br>::<br>:: - CREATE A TEXT FILE called revtag.sh in your OS_GIT_REPO<br>:: -- Place this following line EXACTLY into it.<br>:: echo `git log -n 1 --decorate --oneline | sed -e 's/,.*$//' -e 's,(r/,- r,'` &gt; bin/.version<br>::<br>:: DEPENDENCIES:<br>:: - Installation of GIT TOOLS Windows Installation as per http://opensimulator.org/wiki/Using_Git<br>::&nbsp;!! I installed these two packages as recomended and used the default installations for them<br>:: - http://msysgit.googlecode.com/files/Git-1.6.4-preview20090730.exe<br>:: - http://code.google.com/p/tortoisegit/<br>::<br>:: ==== SET YOUR GIT REPO HERE ====<br>set OS_GIT_REPO=c:\OpenSim_GIT<br>:: ================================<br>:: Appending Path to access all binaries used by GIT<br>::<br>&nbsp;PATH = C:\Program Files\Git\bin;%PATH%;&nbsp;<br>echo&nbsp;%PATH%<br>::<br>echo ON<br>cd&nbsp;%OS_GIT_REPO%<br>::<br>sh.exe revtag.sh </blockquote>
+
 
<br>'''The Shell Script:'''&nbsp; revtag.sh  
+
Place this in /OpenSim_GIT/opensim
<blockquote>echo `git log -n 1 --decorate --oneline | sed -e 's/,.*$//' -e 's,(r/,- r,'` &gt; bin/.version <br></blockquote>
+
 
<br>--[[User:WhiteStar|WhiteStar]] 16:21, 3 October 2009 (UTC)
+
&nbsp;
 +
 
 +
=== The Batch File: GIT_Ver.bat ===
 +
 
 +
<source lang="text">echo off
 +
::
 +
:: FILENAME: GIT_Ver.bat
 +
:: AUTHOR: WhiteStar Magic @ OSGrid
 +
:: DATE: July.12.2010
 +
:: REVISION: 0.3 (3rd release) corrected string info
 +
::
 +
:: DESCRIPTION:  
 +
:: - excecutes the bash command & runs bash script.
 +
:: ::
 +
:: INSTALLATION:
 +
:: - place this on your desktop for easy access
 +
:: - ensure that you have the CORRECT LOCATION defined in the OS_GIT_REPO variable below.
 +
:: !!! Example Structure as I use it.  
 +
:: C:\OpenSim_GIT <--- Top Directory where the SH file is created
 +
:: C:\OpenSim_GIT\bin <--- where the bin directory is located
 +
:: !!! This must run from the ONE directory above where \bin is located !!!
 +
::
 +
:: - CREATE A TEXT FILE called revtag.sh in your OS_GIT_REPO
 +
::
 +
:: DEPENDENCIES:
 +
:: - Installation of GIT TOOLS Windows Installation as per http://opensimulator.org/wiki/Using_Git
 +
:: !! I installed these two packages as recomended and used the default installations for them
 +
:: - http://msysgit.googlecode.com/files/Git-1.6.4-preview20090730.exe
 +
:: - http://code.google.com/p/tortoisegit/
 +
::
 +
:: ==== SET YOUR GIT REPO HERE ====
 +
set OS_GIT_REPO=c:\OpenSim_GIT
 +
:: ================================
 +
:: Appending Path to access all binaries used by GIT
 +
::
 +
PATH = C:\Program Files\Git\bin;%PATH%;  
 +
echo %PATH%
 +
::
 +
echo ON
 +
cd %OS_GIT_REPO%
 +
::
 +
sh.exe revtag.sh</source>  
 +
 
 +
== <br />The Shell Script: revtag.sh ==
 +
 
 +
=== Method-1 (shows Git-Hash, Date&amp;Time Stamp of commit) ===
 +
 
 +
Resulting output in /bin/.version '''"04cb782 2010-10-03 10:39:43 -0700"'''
 +
 
 +
Git-Bash Command to place in the revtag.sh  
 +
 
 +
echo `git log -n 1 --pretty="format:%h&nbsp;%ci"` &gt;bin/.version
 +
 
 +
=== <br />Method-2 (shows Git-Hash, Revision Tag) ===
 +
 
 +
Resulting output in /bin/.version '''"04cb782-r/13617"'''
 +
 
 +
Git-Bash Commands to place in the revtag.sh
 +
 
 +
GitNum=`git log -n 1 --pretty="format:%h-"`<br />RevNum=`git describe --tags`<br />echo $GitNum$RevNum &gt;bin/.version  
 +
 
 +
<br />
 +
 
 +
&nbsp;
 +
 
 +
&nbsp; --[[User:WhiteStar|WhiteStar]] 13:49, 11 October 2010 (UTC)

Latest revision as of 21:12, 3 March 2012

UPDATED: October.11.2010. The revtag.sh shell script

2 Methods are presented for resolving GIT Hash Numbers to generate the ".version" file in the BIN directory so that OpenSImulator can display version info. This aids in providing the version information for filing Mantis Reports and tracking the versions in use on the various simulators.


Contents

[edit] Usage:

1. Copy the Batch file to your desktop and edit the pathing to match your system.

2. Create a revtag.sh in the git reposity, immediately above the bin folder. NOTE! if you perform a git clean this revtag.sh will be removed from the folder structure therefore you will have to copy it back in, I suggest you have a copy of it handy somewhere.

For Example:

/OpenSim_GIT

/OpenSim_GIT/opensim

/OpenSim_GIT/opensim/bin

Place this in /OpenSim_GIT/opensim

 

[edit] The Batch File: GIT_Ver.bat

echo off
::
:: FILENAME: GIT_Ver.bat
:: AUTHOR: WhiteStar Magic @ OSGrid
:: DATE: July.12.2010 
:: REVISION: 0.3 (3rd release) corrected string info
::
:: DESCRIPTION: 
:: - excecutes the bash command & runs bash script.
:: ::
:: INSTALLATION:
:: - place this on your desktop for easy access
:: - ensure that you have the CORRECT LOCATION defined in the OS_GIT_REPO variable below.
:: !!! Example Structure as I use it. 
:: C:\OpenSim_GIT <--- Top Directory where the SH file is created
:: C:\OpenSim_GIT\bin <--- where the bin directory is located
:: !!! This must run from the ONE directory above where \bin is located !!!
::
:: - CREATE A TEXT FILE called revtag.sh in your OS_GIT_REPO
::
:: DEPENDENCIES:
:: - Installation of GIT TOOLS Windows Installation as per http://opensimulator.org/wiki/Using_Git
:: !! I installed these two packages as recomended and used the default installations for them
:: - http://msysgit.googlecode.com/files/Git-1.6.4-preview20090730.exe
:: - http://code.google.com/p/tortoisegit/
::
:: ==== SET YOUR GIT REPO HERE ====
set OS_GIT_REPO=c:\OpenSim_GIT
:: ================================
:: Appending Path to access all binaries used by GIT
::
 PATH = C:\Program Files\Git\bin;%PATH%; 
echo %PATH%
::
echo ON
cd %OS_GIT_REPO%
::
sh.exe revtag.sh

[edit]
The Shell Script: revtag.sh

[edit] Method-1 (shows Git-Hash, Date&Time Stamp of commit)

Resulting output in /bin/.version "04cb782 2010-10-03 10:39:43 -0700"

Git-Bash Command to place in the revtag.sh

echo `git log -n 1 --pretty="format:%h %ci"` >bin/.version

[edit]
Method-2 (shows Git-Hash, Revision Tag)

Resulting output in /bin/.version "04cb782-r/13617"

Git-Bash Commands to place in the revtag.sh

GitNum=`git log -n 1 --pretty="format:%h-"`
RevNum=`git describe --tags`
echo $GitNum$RevNum >bin/.version


 

  --WhiteStar 13:49, 11 October 2010 (UTC)

Personal tools
General
About This Wiki