You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by SVNUser <an...@vertexcs.com> on 2008/12/30 13:05:45 UTC

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

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

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=995932

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

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

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Dec 30, 2008, at 07:05, SVNUser wrote:

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

Yes. Please read the box "Locking Policies" on this page:

http://svnbook.red-bean.com/en/1.5/ 
svn.advanced.locking.html#svn.advanced.locking.break-steal

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1061454

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

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

Posted by Troy Curtis <tr...@gmail.com>.
On Tue, Dec 30, 2008 at 7:05 AM, SVNUser <an...@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@subversion.tigris.org].