Today I came across a problem where someone had accidentally committed a proj.user file to the SVN repository. When i came to update, it obviously caused issues.
It got me wondering if there was any way that you can block certain file extensions to be committed to the repository.
I do realise there is an ignore list but as far as I am aware this still relies on the person to add the files to ignore list. Ideally I would like to control this centrally so that the repository rather than the person has control.
Is this possible?
svn lock — Lock working copy paths or URLs in the repository so that no other user can commit changes to them.
How Locking Works in Subversion. By default, nothing is locked and anyone who has commit access can commit changes to any file at any time. Others will update their working copies periodically and changes in the repository will be merged with local changes.
Yes, in general there are two ways. Either create commit-hooks (which is probably not what you want to do), or, more easily, add the svn:ignore property to your directory. Since properties are maintained along with the project, this will effect everyone. For instance, to ignore *.user
files, you could add this to the directory where they would appear:
svn propset svn:ignore '*.user' .
Then commit your change as usual. From now on, *.user files in that directory will no longer participate in svn commands such as stat, update, commit and so forth. You do have to add the property to each directory that requires an ignore field, however. It does not automatically act recursively on your project tree. If, for any reason, you do want to update an ignored file, you would pass the --no-ignores
flag to the command.
You could possibly add a subversion pre-commit hook to prevent people commiting them. This has the advantage of being server side, rather than a per client setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With