tags:

views:

75

answers:

3

Hi,

I am hosting a project on Google Code, using Subversion. I would like to tag builds with the revision number.

One possibility I have researched is to use svn:keywords to substitute the revision number into some file. This isn't exactly what I want, because it will only tell when that particular file was last changed.

Another option would be to use the output of the svnversion command as part of the build process. This isn't entirely ideal either, because that command may not be present on all systems that will build the code. One idea I had was to make a simple script that emulates svnversion by looking for the revision number in the .svn directory.

So my question is, what's a platform-independent way to accomplish the aforementioned goal? Alternatively, where can I find the specification for files like .svn/all-wcprops (so I can roll my own solution)?

+1  A: 

Probably you are looking for the .svn/entries file. The format of the .svn/entries file has changed over time. Originally an XML file, it now uses a custom—though still human-readable—file format.

Shaji
Sadly the format no longer seems to be XML, but apparently it's still human-readable: http://svnbook.red-bean.com/nightly/en/svn.developer.insidewc.html#svn.developer.insidewc.entries
miorel
@miorel thanks I have updated the answer.
Shaji
A: 

I'm using both svnversion (under linux) and SubWCRev.exe (under windows). The latter is a tool included in TortoiseSVN. I actually put it in my sources' repository, to make sure it's available on every (windows) build machine.

For Linux platforms, I just assumed that if the machine could checkout the sources, it necessarily had svnversion... But maybe I'm wrong here.

Note that the two tools are not used the same way : svnversion displays the version on the standard output, so you need to use it and patch your sources your own way. SubWCRev.exe is able to patch existing text file by replacing specific keywords.

Little Jawa
A: 

We also tag our builds with the svn revision number. Check out the batch file we run as a pre-build event to extract the revision number (and bake it into the resource file) here

Jaco Briers