A bash script puts the current SVN version number in a #define in a C++ header file, which is then included in the project and displayed in the 'About box', next to the official version number.
I have included the script below that extracts the version number from the top level .svn/entries database in the project, and puts it in a file VERSION_CPP_FILEPATH that contains the row
"#define SVN_VERSION = "
This bash script is then executed as a pre-build action in our IDE.
#/!bin/sh
VERSION_CPP_FILEPATH=../inc/version.hpp
SVN_ENTRIES_PATH=../../.svn/entries
VERS=`cat $SVN_ENTRIES_PATH | grep dir -A 2 | sed -n '2p'`
sed "s/#define SVN_VERSION .*/#define SVN_VERSION $VERS/g" $VERSION_CPP_FILEPATH > tmp.hpp
rm $VERSION_CPP_FILEPATH
mv tmp.hpp $VERSION_CPP_FILEPATH
Grymt! Känns absolut som det bästa sättet att ange vilken version som körs.
SvaraRaderacat $SVN_ENTRIES_PATH | grep dir -A 2 | sed -n '2p'
SvaraRaderaverkar rätt krångligt och väldigt beroende av att formatet på .svn/entries inte ändras i framtiden. varför inte använda "svn info"?
svn info | awk '/Revision/ { print $2 }'