How to Add SVN Properties to Files

How to Add SVN Properties to Files
0 votes, 0.00 avg. rating (0% score)

You can add SVN properties to your files with these two simple steps:

Step 1: Set svn:keywords property to the file.


$ svn propset svn:keywords "Rev" MyClass.java

Rev (or Revision) is not the only keyword to be used for substitution. The others are Date, Author, HeadURL and Id. You can also use more than one of these keywords at the same time by giving a space between them.
If you are using Eclipse, just give Team>Set Property command for the file to do the same operation.

Set Property

Step 2: Add keywords in your file

Now add these keywords you wish to be replaced anywhere in your file between two $ characters, such as:

/*
* Revision No    : $Rev$
* Last changed on: $Date$
*/

After that, each time you commit your file to SVN, your keywords will be changed with the actual values.

/*
* Revision No    : $Rev: 7 $
* Last changed on: $Date: 2009-10-11 15:48:24 +0300 (Sun, 11 Oct 2009) $
*/

Tagged with:
Posted in Blog
1 Comment » for How to Add SVN Properties to Files
  1. Svn Fan says:

    Cool, I always wondered how people did that.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


+ three = 6

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>