Adding Subversion (SVN) Properties to your code

by Adrian Mejia in February 11, 2012

When you are coding in a team enviroment it's good to have the subversion properties in your files, that way any other developer can see quickly who made the last changes and when.

You can add the following lines at the bottom of your code:

//-----------------------------------------------------------------------------
//  REVISION HISTORY
//  $LastChangedDate: $
//  $Revision: $
//  $LastChangedBy: $
//  $Id: $
//-----------------------------------------------------------------------------
 
And when you perform your svn commit will be automatically populated something like this:
//-----------------------------------------------------------------------------
//  REVISION HISTORY
//  $LastChangedDate: 2012-02-11 18:24:39 -0500 (Sat, 11 Feb 2012) $
//  $Revision: 61 $
//  $LastChangedBy: adriansky $
//  $Id: Heap.java 61 2012-02-11 23:24:39Z adriansky $
//-----------------------------------------------------------------------------
 
Also you need to set the SVN properties for that file. The Properties that you need are the following:
  • svn:eol-style  ---> LF
  • svn:keywords ---> LastChangedDate Revision LastChangedBy Id
If you are using Eclipse you can edit it following this steps:
  1. right click file you want to add svn properties
  2. Menu team > set properties (image bellow)
  3. Select the Property name from the combobox (image bellow)
  4. Add the text property in the text box (image bellow)
  5. You can also use files to avoid all the typing every time. right click and 'save as...' to <svn-keywords> and <svn-eol-property>.
  6. Commit and you are all set.

Eclipse Menu to add svn properties

Eclipse SVN Property Menu

Adding SVN properties typing

Adding SVN property from file

SVN property from file

Tags: svn, subversion, eclipse, svn properties

Add a new comment