Enable Auto Properties (auto-props) for Subversion (Subclipse) in Eclipse

Setting auto properties (auto-props) allows for specific files to have unique properties applied such as mime types (svn:mime-type), end of line (svn:eol-style), and my personal favorite: svn:keywords.

I use svn:keywords to automatically update the following fields that I store at the top of each code file: "LastChangedDate LastChangedRevision LastChangedBy Id". Each time I commit a file relevant data is updated on the file itself that can tell me who last committed changes and when they did. As well the version number is updated.

The header of each file contains the following tokens:

$LastChangedDate:$
$LastChangedRevision:$
$LastChangedBy:$

To enable this in Eclipse first create a custom subversion config directory and file. I typically create a ~/var/lib/subversion/conf/ directory and add a text file to it called "config". I then add the following to the config file:

[miscellany]
enable-auto-props = yes

[auto-props]
* = svn:keywords=LastChangedDate LastChangedRevision LastChangedBy Id

Now open Eclipse and go to Windows->Preferences->Team->SVN and set the "Configuration location" to "Use directory" and browser to the newly created conf directory.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Works but...

Nice info to share. It only seems to work for new files for me (ie ones that weren't under source control before I pointed to the new config directory).
Still, great time saver.

default config file

Can I also edit the default subversion config file and uncomment the enable-auto-props property and add the * under [auto-props ] ?
I've done this. But I don't have the impression Eclipse is noticing this because the properties aren't replaced when I commit.
The only thing that works is using Team - Set property. But I don't want to use that feature because it doesn't allow me to state that I only want these keywords "used" on particular types of files. Eg only .java files.
Any advice
Thanks,
EDH

re: default config file

The autoprops will only be added on new files. To only have this apply to .java file try using "*.java" instead of "*".

Post new comment

The content of this field is kept private and will not be shown publicly.
By submitting this form, you accept the Mollom privacy policy.