[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Reg: Prevent breaking a lock on a file by other users

From: Troy Curtis <troycurtisjr_at_gmail.com>
Date: Tue, 27 Jan 2009 21:37:55 -0600

On Tue, Dec 30, 2008 at 7:05 AM, SVNUser <anild_at_vertexcs.com> wrote:
> Hi:
>
> We are using Tortoise SVN Client;
>
> We have a concern in SVN Usage:
>
> For example-
>
> 1. User A obtains a Lock on a file in a SVN Repository by using Get Lock
> option.
>
> 2. From Repo-Browser, User B can break the lock on the same file in SVN
> Repository - make any modifications and do commits.
>
> Is there an option to prevent User B from breaking the lock?
>
> Thanks,
> SVNUser

You can use the pre-lock and pre-unlock hook scripts [1] to check that
the user is the owner of any existing lock, and if not reject the lock
break request. In fact the example pre-lock and pre-unlock scripts
that subversion drops into your hooks directory does just that. To
turn this "feature" on simply rename the pre-lock.tmpl file in your
repository "hooks" directory to 'pre-lock' and make it executable.
Similarly rename 'pre-unlock.tmpl' to 'pre-unlock' and make it
executable. Users should no longer be able to break other people's
locks.

The other thing to think about is why you need this. User B has to
take an explicit action to break User A's lock, which means you likely
have a communication issue. As in, when User B finds that a file that
he wants to commit is locked by User A, he should talk to User A so
that they can sort it out. Indeed the idea behind locks in subversion
is really to just be informational [2]. Also, now if User B really
does need to break the lock but User A is not around, a repository
administrator will have to get involved. Maybe that is what you want,
but you should definitely think about it.

Refs:
[1] http://svnbook.red-bean.com/en/1.5/svn.reposadmin.create.html#svn.reposadmin.create.hooks
[2] http://svnbook.red-bean.com/en/1.5/svn.advanced.locking.html

-- 
"Beware of spyware. If you can, use the Firefox browser." - USA Today
Download now at http://getfirefox.com
Registered Linux User #354814 ( http://counter.li.org/)
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1061537
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-01-28 04:38:55 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.