SVN: How to make a file read-only with subversion?

回眸只為那壹抹淺笑 提交于 2020-01-03 07:00:25

问题


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 that 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?


回答1:


svn lock

Also, worth a read is Advanced Locking




回答2:


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).




回答3:


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



来源:https://stackoverflow.com/questions/2277258/svn-how-to-make-a-file-read-only-with-subversion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!