Thursday, December 20, 2007

Enabling the CVS Id Tag for SVN

The CVS Id tag which adds file information on the file itself upon commit is enabled by default on CVS but not on SVN. To have it enabled you need to add/modify the following on your local SVN configuration file (on UN*X: <HOME>/.subversion/config):

[...]
enable-auto-props = yes

[...]
[auto-props]
[...]
*.java = svn:keywords=Author Date Id Revision;svn:eol-style=native

Complete list of keywords: Author, Date, Header, Id, Log, Locker, Name, RCSFile, Revision, Source, State.

Of course, you need to add a line for every file type you want to configure for a fine grained control over that. Otherwise use *.

This works for all files committed from now on. If you already have files in the repository, you need to tell SVN to add them too:
# Make sure that everything is up to date
> svn up
# Add keywords and commit
> svn propset svn:keywords "Author Date Id Rev" file_name
> svn commit -m "Adding Id and Rev property to all files"

1 comment:

Glenn Enright said...

Nice, this post laid it out in a nice readable way.