Question

Is there any way to prevent users from performing "SVN update" on any locked files or at least show them a msg that this file is locked by someone? because we have a project based on oracle forms & reports v5.0( i know it's very old :) ). as known oracle forms & reports stores their Source Files in Binary Format. so we can't compare 2 forms when a conflict occurred. so by preventing the users from updating the solution they know that someone is working on this project and just try to work on other projects instead of working all the day on the same project without being able to commit their changes at the end of the day(if the project is locked) or end up by having a conflict without being able to resolve it. Or at least having some kind of notification that this project is locked when updating it

P.S. I'm using VisualSVN Server 2.7.3 and TortoiseSVN 1.8.4.

Était-ce utile?

La solution

Why do you want to prevent users from updating their working copies? (BTW aren't you confusing svn update with svn commit?) Describe and explain us the case and the task you have in general.

If the file is locked by another developer, no one can svn commit changes for this file except the particular developer. In other words, only lock owner can modify the file and commit it's changes (unless no one breaks / steals the lock).

On the other hand, svn update command updates your working copy with newer revisions from the repository. The operation will update files locked by someone in the repository. The only way to prevent users from updating their working copies, is to use path-based authorization rules on server-side to completely deny access to the repository for the particular user.

I suggest reading SVNBook | Locking section for more information on locking mechanism in Apache Subversion.

Update:

See SVNBook | Lock communication section. The section covers the issue you describe.

  1. You can use svn:needs-lock property to instruct Subversion clients that particular (or all) files must be locked before they attempt to modify them. Unless file is locked, it's in read-only state and can't be modified.

    I see that you use VisualSVN Server 2.7 and TortoiseSVN 1.8, both of them are based on Subversion 1.8. Subversion 1.8 clients feature the Repository Dictated Configuration. Thanks to this new feature, you can configure auto-props patterns within a repository using the new Subversion svn:auto-props inherited property.

    For example, if you set svn:auto-props value to *.test = svn:needs-lock=* property on the root of your repository (or repository path that represents a root of a project, it mostly depends on your repository structure) will result into each newly added *.test file having svn:needs-lock=* property applied.

    BTW, TortoiseSVN has special status icons for unlocked files that have svn:needs-lock property applied, see TortoiseSVN manual.

  2. You can setup post-lock and post-unlock hook scripts on the repository. These hook scripts can be used to implement mail notifications when someone locks or unlocks a file in the repository. Read more about Subversion hook scripts in the SVNBook | Implementing Repository Hooks.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top