Archive for July 19th, 2009

How to add revision id to SVN controlled files

July 19, 2009

First register the file with subversion for keyword substitution. For example, you may need to add the actual revision number to the source code.

$ svn propset svn:keywords "Revision" source_file.c
property 'svn:keywords' set on 'source_file.c'
$

Next, edit your source code and add the keywords that you wish to be replaced, e.g.

#define VERSION "V 1.0 $Rev$"

Finally, from now on each time you commit the file to subversion, e.g., after you commit the file:

$ svn commit source_file.c -m "file with rev. id"
Sending        source_file.c
Transmitting file data .
Committed revision 190.
$

Now if you view your source code, it will have the revision number in the code, e.g.

#define VERSION "V 1.0 $Rev 190 $"

and each time you edit and commit the changes the revision number will be updated.


Follow

Get every new post delivered to your Inbox.