Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to block files being committed to SVN repository

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?

like image 730
Dean Avatar asked Jan 06 '09 12:01

Dean


People also ask

What is svn get lock?

svn lock — Lock working copy paths or URLs in the repository so that no other user can commit changes to them.

Does svn checkout lock files?

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.


2 Answers

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.

like image 170
Jason Coco Avatar answered Sep 23 '22 16:09

Jason Coco


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.

like image 37
Steven Robbins Avatar answered Sep 23 '22 16:09

Steven Robbins