Posts Tagged ‘eclipse’

How to enable keywords in Eclipse and Subversion (SVN)

Thursday, March 26th, 2009
I’ve used CVS (Concurrent Versions System) for years, and really like the keyword substitution feature.  It’s not hard to grok – when a file is committed to CVS, it is first scanned for words that should be replaced.  Specifically, if a text file contains the following:
//  File name: $HeadURL$
//  Revision: $Revison$
//  Last modified: $Date$
//  Last modified by: $Author$
//
//  description of the following file...

Then after it is checked in with keyword substitution, it looks like this:

//  File name: best-practices.php
//  Revision: 1.1
//  Last modified: 2009-02-26 22:27
//  Last modified by: mclark
//
//  description of the following file...

Even better, I usually just use the single line version of “$Id$” that puts all the important information into a single line.

//  $Id: best-practices.php 1619 2009-02-26 22:27 mclark $
//
//  description of the following file...

However keyword substitution is not activated by default from within Eclipse and its SVN module titled Subclipse.  Eclipse is the best IDE (Integrated Development Environment) that I’ve ever used (but it won’t be explained here).  These are the steps to activate the svn-keyword-substitution feature in Eclipse:

  1. Install Subclipse into your Eclipse application (you’ve probably already done this if you’re reading this post!)
  2. Right-mouse-click on your project folder, and choose Team => Set Property from the popup menu
  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

Now keywords are substituted when you commit a file in SVN, just like they were in CVS.  Also, you can shorten Revision to Rev and HeadURL to URL.

Matt Clark worked in academia, corporate research labs and several technology startup companies prior to GORGES. His expertise is software architecture, database development, and system administration. Matt brings GORGES over 25 years experience developing fast and robust software on a multitude of platforms and languages.