tags:

views:

2265

answers:

4

This is driving me nuts so any advice from fellow users would be welcome. I am using Subversion, with a copy of VisualSVN 1.6.1 installed on a Windows server. On my PC I am using a combination of TortoiseSVN and the wonderful AnkhSVN Visual Studio plugin. Everything works like a dream, but now I am trying use the svn:keywords feature so I can include $Id$ at the top of all my source files. Now, for existing files I can edit the SVN properties and add this keyword and it all works fine, but I want this done automatically for new files - and I cannot make it work.

According to the documentation you need to edit a special Subversion Config file located in your C:\Documents and Settings\<user>\Application Data\Subversion folder. My PC already had a copy of this file, so I changed it to look like this:

[miscellany]
enable-auto-props = yes

[auto-props]
*.cpp = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.hpp = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.rc = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.rc2 = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.cc = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.c = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.h = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.wsf = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.js = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.htm = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.html = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.css = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision

I then added a new file to an existing Visual Studio project (from within Visual Studio), added $Id$ to the top and committed it - but, alas, the svn:keywords property is not being set.

Does anyone know how to get this working? I even tried adding settings to the registry (in HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config) but still no joy. I then tried messing with Config files on the SVN server itself, but nothing seems to work.

I have obviously missed something blindingly obvious!

+1  A: 

If you want to be sure you've picked the correct config file, use TortoiseSVN's edit button: Subversion Wiki.

The only similar problem I could find was a user complaining about this not working with uppercase file extensions, but this is for Fedora, not for Windows: link

schnaader
+2  A: 

It seems that the answer is just some silly quotes around the actual keywords :)

[auto-props]
*.cpp = svn:eol-style=native;svn:keywords="Author Date Id HeadURL Revision"
LenW
did that solve it ?
LenW
This is did NOT solve it for me.
HDave
My problem was making this change on the server when it (unfortunately) need to be made on the client!
HDave
A: 

This seems to be an issue with AnkhSVN. I did some tests outside of Visual Studio, using TortoiseSVN to add the files, and it started working (using my user config file). I will try the latest AnkhSVN to see if this makes any difference.

I'd prefer to have this done at the server end, but this seems to be user-specific.

Either way, thanks for the pointers Len and schnaader.

Rob
AnkhSVN caches your Subversion user settings. You should restart Visual Studio to reapply the global settings.
Bert Huijben
A: 

hi Rob,

You're right, the issue lies with AnkhSVN. The keywords properties will not be automatically added if the new file is added in Visual Studio (with AnkhSVN 2.0.5250). It will only be added if you add the file using Tortoisvn.

I downloaded a trial version of VisualSVN (plugins to Visual Studio). It does not have this issue. Properties are automatically added to new files added in Visual Studio.