I need to prevent users from committing one specific file under svn unless they got a lock for it. I used the svn:needs-lock property and it does what I want, but there is a limitation there - users cannot edit the file locally for testing purposes. These are model (DevEx - xml) files, and while merging them is a giant pain (hence the need for a lock) I'd like to give the users the ability to modify the file locally, but prevent them from checking it in without getting a lock.
Can it be done? How?
The purpose of a lock in Subversion isn't strictly to prevent users from committing - it's to help prevent users from locally editing a file that can't be merged when they perform an update later.
SVN locks are there to facilitate communication between users - they are not intended to be an airtight "this is locked down" system. If you're having frequent issues with developers conflicting over these locks, you need better communication between them.
If your users really need to edit the file locally without taking a lock, they can remove the read-only attribute on their local copy manually - as long as they understand the ramifications of doing so (they won't be able to update/merge until they
revert
their local changes).An alternative would be to make your model a "template" and require users to make local copies for their editing purposes. Then lock, update and commit the template when they're done with their changes and are ready to share with others. See the Subversion FAQ for more. But you'll still have a merge issue to contend with. Again, communication is the solution here, not software.