SVN: How to make a file read-only with subversion?
I am working on a large web project which is managed in an SVN repository.
Each time a team member checks out the project, or we check out the project on a new production server, we have to modify a custom configuration file for that server. I have a "config.ini.base" file under revision control, which we keep updated with the latest settings, the idea being t开发者_开发知识库hat team members copy that to create their "config.ini" (which is listed under 'ignore' on the directory).
To avoid confusion and mistakes, I'd like to somehow block any changes to "config.ini.base" from being committed to the repository, unless it is committed explicitly or the read-only setting is somehow explicitly overridden. How would I do this?
svn lock
Also, worth a read is Advanced Locking
As Trevor and Craig have said, the way to do is with SVN's locking capabilities.
Setting svn:needs-lock
on a file will make it read-only unless the user has locked the file.
Here is a link to the most recent documentation (the other links are out of date).
Try setting up the pre-commit hook from here
http://www.cita.utoronto.ca/~shirokov/soft/svn-hooks/svn-read-only/pre-commit
Once you have it set up, set the svn-read-only property onto your file (or a directory) with
svn ps svn-read-only on config.ini.base
精彩评论