Enable keywords substitution using Eclipse and Subversion (SVN)

Vista-eclipse

Image via Wikipedia

To enable keywords substitution as I usually have with the CVS, you just need to enable a svn properties on the Eclipse project configuration.

These are the steps to activate the svn-keyword-substitution feature in Eclipse:

  1. Install Subclipse into your Eclipse application
  2. Right-mouse-click on your project folder, and choose Team => Set Property from the popup menu (note to click on the root of the project folder)
  3. Enter the property name:  svn:keywords
  4. Enter the text property:  Author Date Id Revision HeadURL
  5. Click the  Set property recursively checkbox
  6. OK

Note that on large project files this action could take also several minutes. Now keywords are substituted when you commit a file in SVN, just like they were by using CVS.  Also, you can shorten Revision to Rev and HeadURL to URL.

So if you now have a file like:

// File name: $HeadURL$
// Revision: $Revison$
// Last modified: $Date$
// Last modified by: $Author$
//
//  file description

commiting it to the SVN will result into:

//  File name: afile.php
//  Revision: 1
//  Last modified: 2010-11-4 14:53
//  Last modified by: quonn
//
//  file description

 

2 Responses

  1. Thanks for the blog. I wanna mark just one minor change. The result will expand to:

    // File name: $ HeadURL: afile.php $
    // Revision: $ Revison: 1 $
    // Last modified: $ Date: 2011-03-07 13:53:29 +0100 (Mo, 07. Mär 2011) $
    // Last modified by: $ Author: quonn $
    //
    // file description

    regards, mike

Leave a Reply

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

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: