How to add revision id to SVN controlled files

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.

Advertisement

One Response to “How to add revision id to SVN controlled files”

  1. dino Says:

    this will add the file version number…i want to add the top folder version number .. can u tell how to do that

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.