views:

170

answers:

2

I used windows security to block to users the option of deleting files from the server on SVN clients. (right-click on the repository dir, and security options).

now I want to commit a local directory back to the server, but I deleted one file from the dir. I get an error says I don't have permission to delete.

is there any other way to bypass this?

Oded.

+2  A: 

Why are you doing this? First of all, the security rights on the repository (server-side) have actually nothing to do with the access rights of a client.

Now you should ask yourself whether you really want to trap deletes. In svn, everything is undoable at any time. When you commit a delete, svn does not physically delete anything, it just records something like 'in revision x of this repository, file y got deleted'. Subsequent checkouts/updates will obviously not check out that file anymore, but a delete can be easily undone (see svn revert).

If you're still convinced that you need to prevent users from committing deletes, you should write a pre-commit hook script, in which you can use the svnlook tool to examine the transaction being committed. Exit the hook script with a non-zero value if it contains deletes.

jeroenh
The pre-commit hook will be activated if I'm deleting localy and then commiting. that's OK.what I want to prevent is, that a user will open the TortoiseSVN, click on a file (on the server) and delete it. that I want to prevent.
Oded
is there any way to use the authz file to modify something?
Oded
I think you've got something confused here. Deleting a file via the repository browser of TortoiseSVN does not directly delete anything on the server, but performs a 'client-side' delete using the 'svn delete' command. The net result is exactly the same as doing the delete after a checkout (checkout - local delete - commit).Just try it: you have to enter a commit message, and the delete will be recorded in the history of your repository.
jeroenh
+1  A: 

Deleting a file using tortoisesvn repo browser does not cause any existing files to be deleted from the windows directory containing the repository. In fact it adds 2 files - the record that the file was deleted and the comments associated with that record (ok, I simplified).

However, making any change on the repository requires the ability for the server to delete files from the windows directory containing the repository. Changes are first recorded in a new transaction file, then the repository is modified according to the transaction, then transaction file is deleted. This happens on every change, even if you're just changing a comment in a file. Preventing normal file operations in the repository's directory is going to corrupt the repository.

There is no functional difference between using tortoise svn to delete a file, and checking out a working copy, deleting the file, and committing the result. All required permissions and structural changes are identical. All the same hooks get fired in the same order and they get the same information. Both record a revision saying the file was deleted, and that revision can be reverted in both cases. You can't separate the activities. If you prevent one, you prevent the other.

Jim T