0

I'm using SVNKit to programatically interact with an SVN server. At some point I need to prevent any further changes to a repository directory. My intial idea was to do this using a lock, but then I discovered that SVN locks are breakable (and stealable), but I need to really enforce that the directory cannot be modified. I know that I could make the locks unbreakable by writing a hook script, but this will complicate deployment, and introduce platform-specific dependencies.

My next idea is to solve this problem by changing the permissions on the directory that needs to be locked down. I'm able to do this using the VisualSVN server management console, but I haven't found any way to do this via the SVNKit API. Is this feature exposed via the API, and if not, is there another way to lock down the directory?

Thanks!

Dónal
  • 185,044
  • 174
  • 569
  • 824
  • What tool are you using for the SVN server management console? Are you using apache/ssh/svnserve? – kevpie Dec 06 '10 at 14:49
  • I'm using the VisualSVN Server management console (question updated) – Dónal Dec 06 '10 at 15:18
  • SVNKit is used for client side access, i am not sure but the library doesnt support svn managment. You might modify the svn authz file to do such things. http://stackoverflow.com/questions/81361/how-to-setup-access-control-in-svn –  Dec 06 '10 at 15:38
  • 1
    Unbreakable locks are a huge PITA when the lock holder goes away. Why do you need them? Are your developers really that antagonistic to each other? – Donal Fellows Dec 06 '10 at 15:51
  • @Donal - The repo won't be accessed by any developers (antagonistic or otherwise), just my program. The locks are simply one possible way of ensuring that a directory in the repository is unwriteable. – Dónal Dec 06 '10 at 16:32
  • @Ozhan - that's exactly the functionality I need, but I need acccess to it from the SVN API – Dónal Dec 06 '10 at 16:36

1 Answers1

0

Out of the box, Subversion allows locks to be stolen. However, you can change this behavior by enabling the pre and post lock and unlock hooks scripts. The templates for these hooks will show the basics of how to prevent the locks from being stolen. You can also find more information here in the "Locking Policies" section. As a good measure though, you should allow named administrators to be able to break or steal the locks on a repository. Nothing like the guy who goes on vacation who has everything locked and no one can do work! Or in your case, they guy who writes an app that locks everything and now he's gone on vacation! :-)

jgifford25
  • 2,164
  • 1
  • 14
  • 17
  • Thanks for the info, but as I said in my question, I would prefer not to use locks and hook scripts. Instead, I would like to make a directory read-only by changing the permissions, if it's possible to do this using the SVNKit API. – Dónal Dec 06 '10 at 17:40
  • @Don: May not be possible with SVNKit alone, but in combination with Java and SVNKit, you should be able to come up with a good solution. – jgifford25 Dec 06 '10 at 19:34
  • Maybe I should be, but I haven't yet – Dónal Dec 09 '10 at 08:39