I\'d like to implement a way of recording the version of a project within code, so that it can be used when testing and to help track bugs. It seems the best version number
While nifty, the revision keyword trick only updates the file when it's changed in that revision - if you don't change the file, then it will continue to reflect the old revision.
If you want the software to always reflect the overall revision number, then you'll have to delve into the relevant SVN entries file and extract it, which isn't too difficult (it's an XML file).
Wikipedia does this on their version page to indicate the revision of the software that's running live; the code is here - look for the getSvnRevision() method.