Attached is a script that I made for one of my projects.  It extracts hash and 
timestamp from the git log.

The important bits are these two lines:
COMMIT_TIMESTAMP=`git log -n 1 --pretty="format:%ct"`
COMMIT_INFO=`git log -n 1 --pretty="format:%h: %cd"`

With the --pretty format option you don't even need to parse the log output.

On Friday 07, Chris Down wrote:
> James,
> Just a thought.
>
> You could use the git log command to extract the information form the
> repo. This would output details of the last commit e.g.
>
> git log -n 1
>
> commit 270ae50d700831ac996025045dc32341d68ee0f9
> Author: Adam Frisby <[email protected]>
> Date:   Fri Aug 7 14:17:51 2009 +1000
>
>      * Implements MRM's Stop() interface member.
>      * MRM Scripts should do appropriate cleanup within this event, to
> allow for clean shutdowns and script updates. This means unbinding from
> events you are listening to, and releasing any resources.
>
>
> All the information you need is in this text. You could then add a post
> commit script that parses the text to extract the information and put
> this into a file which could be read by the show version command.
>
> Chris
>
> On 07/08/2009 04:53, James Stallings II wrote:
> > So far Adam it's just the hash, but I've not got even that working yet
> > so I will see if I can find a way to get a date in there too :)
> >
> > Cheers!
> >
> > On Thu, Aug 6, 2009 at 10:00 PM, Frisby, Adam <[email protected]
> > <mailto:[email protected]>> wrote:
> >
> >     Does that store the date of last ‘commit’ or current revision?
> >
> >     If we’re replacing the version number from 0.X.Y.SVNNUM – I think we
> >     should probably use:
> >
> >     0.X.DDMMYYYY.GITHASH – since the DDMMYYYY is going to be a lot
> >     easier to type.
> >
> >     Adam
> >
> >     *From:* [email protected]
> >     <mailto:[email protected]>
> >     [mailto:[email protected]
> >     <mailto:[email protected]>] *On Behalf Of *James
> >     Stallings II
> >     *Sent:* Thursday, 6 August 2009 4:39 PM
> >
> >     *To:* [email protected]
> > <mailto:[email protected]> *Subject:* Re: [Opensim-dev] Main
> > Repository now in Git
> >
> >     Greetings List  :)
> >
> >     Just wanted to drop a line to the list and let you all know that
> >     we've (OSGrid Core Team) done a bit of research and determined the
> >     location of the file in the which git stores the hash for the the
> >     checked out tree (for lack of better terminology).
> >
> >     I am personally finishing up a patch at the moment to replace the
> >     appearance of the svn revision number with the git hash where it has
> >     been present before (in the client, at region server startup and at
> >     in the region server's 'show version' command output).
> >
> >     Please bear with me, I am not a core dev either and fumble a bit
> >     here and there with the tools, but I am rapidly improving my skills
> > ;)
> >
> >     I will notify the list as soon as I have the patch ready.
> >
> >     ETA: sometime this evening CST.
> >
> >     Hope this eases some concerns among you.
> >
> >     Cheers!
> >     James
>
> _______________________________________________
> Opensim-dev mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/opensim-dev



-- 
Robert G. Jakabosky

Attachment: update_build_info.sh
Description: application/shellscript

_______________________________________________
Opensim-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/opensim-dev

Reply via email to