Brian Lacy
Brian Lacy

Reputation: 19118

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

Upvotes: 13

Views: 23388

Answers (3)

user1101290
user1101290

Reputation: 49

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

Upvotes: 5

Michael Hackner
Michael Hackner

Reputation: 8645

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

Upvotes: 11

Trevor
Trevor

Reputation: 6689

svn lock

Also, worth a read is Advanced Locking

Upvotes: 16

Related Questions