views:

108

answers:

1

I've been driving myself crazy over the past few days over this one. We've just finished setting up a Hudson Continuous-Integration server. So it runs a build script each and every commit to validate the commit. The issue is that it validates that all the files in the repo have both the svn:keywords = "Id" and svn:eol-style = "LF" properties set on all .php files, which normally would be great (The last time I did this, I used Eclipse and Tortoise SVN, which both have svn::add functionality).

But the problem is that I've grown quite accustomed to Netbeans. And Netbeans has no svn add function that I can find (It add files automatically upon commit). The problem is that I can't add the properties until the files are added. If I commit without adding the properties, the build will fail. So I wind up failing the build every other commit because I need to take 5 steps (commit, recursive propset, commit, acknowledge failed build, delete failed build), to do something that would normally only take 2 (propset, commit).

I don't really want to go back to Eclipse at this point, but when it takes me 20 minutes to commit because I need to do everything 4 times, it's going to get old quickly... Is there some workaround that I'm missing (Short of removing the property check, which will defeat the point, since I want those properties set anyway)? Or am I just SOL?...

+1  A: 

Subversion has a ~/.subversion/config file that allows you to customize a number of different settings, among which is auto-props, properties that are automatically set on files based on their extension:

So, assuming Netbeans respects that file, you can tell svn to automatically set those properties by changing the [auto-props] section to include *.php = svn:eol-style=LF;svn:keywords=Id

For example:

[auto-props]
# here's yours
*.php = svn:eol-style=LF;svn:keywords=Id
# and one with multiple keywords
*.c = svn:eol-style=native;svn:keywords=Author Date Rev Id HeadURL
# and one with a mime-type
*.png = svn:mime-type=image/png

UPDATE:

Netbeans 6.9 appears to read in the ~/.subversion/config file on startup and does NOT pickup changes without a restart. After restarting Netbeans, it correctly picks up my selected auto-props and applies them to each newly created file.

UPDATE 2:

Netbeans appears to read through both the global and personal subversion configuration files (among many other subversion files) when it starts up. Here's a relevant portion as seen by strace:

stat("/home/kibab/.subversion/config", {st_mode=S_IFREG|0644, st_size=4576, ...}) = 0
open("/home/kibab/.subversion/config", O_RDONLY) = 28
open("/etc/subversion/config", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/home/kibab/.netbeans/6.9/config/svn/config/config", {st_mode=S_IFREG|0644, st_size=825, ...}) = 0
stat("/home/kibab/.netbeans/6.9/config/svn/config", {st_mode=S_IFDIR|0755, st_size=61, ...}) = 0
open("/home/kibab/.netbeans/6.9/config/svn/config/config", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 28

Further examination seems to imply that once it's read through the config files, it then writes out a copy (using O_TRUNC) of the configuration file which it stores at ~/.netbeans/6.9/config/svn/config/config (at least on Linux).

Based on this, I assume that Netbeans is attempting to be intelligent enough to use whatever subversion settings you have set in your config files, both global and personal.

Kaleb Pederson
Well, I commented above, but it appears as if Netbeans is reloading that file every time I perform any kind of SVN activity (commit, update, etc). I can't find a setting for it inside of netbeans... I'll just have to dig more tomorrow...
ircmaxell
I tested on my copy of Netbeans-6.9. I couldn't find a place to specify the `auto-props` within the IDE, but it does respect changes to `~/.subversion/config` after a restart of Netbeans.
Kaleb Pederson
I tried that. My version has it in both `~/.subversion/config` and in `~/.netbeans/6.9/config/Subversion/config`. The second one is the one that keeps getting overwritten. (This is on Windows btw)... I'll play around with it more tomorrow when I'm at work...
ircmaxell
That did it. All I needed to do was edit the correct config file. The file that did it was `~\Application Data\Subversion\config`. All others were being ignored. Thanks for the help!
ircmaxell