Archive

Posts Tagged ‘coding’

Displaying the latest global Subversion revision ID in an application

June 21st, 2010 niels No comments

When you have to display the latest global svn revision number in your application you face different options.
Using Subversion keywords, like $Revision$ or $Id$, sounds like the most natural approach. Unfortunately the keywords are updated only when you change and commit the corresponding file. In short: if you intend to grab the revision ID from a central header file, like version.h, this file has to be edited and committed whenever a svn commit on any file in your project takes place. So either you do that manually (“erm, no?” – right!), or you create a commit hook and bloat your repository.
Another approach is to fetch the latest number of the latest revision and update your version.h as part of your build. In short: whenever you trigger a build by calling make, ant or build your project in your IDE, you invoke a script that generates your header file (or .java, .cs, .rb … you name it). On Linux and Unix, you might use a script just like this:
Read more…