You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Luca Cappa <lu...@sequoia.it> on 2006/07/20 07:37:18 UTC

Enforcing the lock of a file prior to its commit.

Hello,

i am searching for a way to prevent that a not locked file could be  
committed. I think
i could achieve that writing on my own a prehook script, but i am  
searching for a
working out of the box solution. Any help?

TIA
Luca

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Enforcing the lock of a file prior to its commit.

Posted by Steve Williams <st...@kromestudios.com>.
Luca Cappa wrote:
> No, cause if you try it, you could commit a file with that property set  
> even though you havent locked it. The trick is to just remove the  
> read-only flag on that file, modify it and then commit it. Try it and you  
> will see
> that locks as they are appear to be totaly useless.
>   

You need better discipline in your team.  If a member of my team changed 
the read-only flag to edit the file without locking it, they would get a 
very quick and stern reprimand.

-- 
Sly



This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Enforcing the lock of a file prior to its commit.

Posted by Erik Huelsmann <eh...@gmail.com>.
On 7/21/06, Johan Appelgren <jo...@gmail.com> wrote:
> On 7/21/06, Luca Cappa <lu...@sequoia.it> wrote:
> > On Thu, 20 Jul 2006 15:31:57 +0200, Johan Appelgren
> > <jo...@gmail.com> wrote:
> > >
> > > Have you looked at writing a pre-commit hook that does what you want?
> > >
> > > That wouldn't stop anyone from editing a file, then get the lock and
> > > then commit though. So I'm not sure what you'd gain?
> >
> > I would gain that the person needs to get the lock. If the lock is already
> > being held
> > by someone else, this guy is warned that the next time he removes the
> > read-only flag
> > (and changes it and then fails to lock it) he will remember to check if
> > there is
> > already any lock on that file prior to apply any modification to it.

This will gain you exactly as much as without locking: you won't be
able to commit to a resource which is older than the repository HEAD
version anyway. Committing a file (locally modified) which is at
revision 3 locally and at rev 5 in the repository, will result in a
'resource out of date' error. So, what do you gain by generating an
almost exact error like that your way? (Updating before the commit
works, but won't incorporate the changes in the repository in the
local file; the developer will need to remove the 'C'onflict state
first...)

bye,

Erik.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Enforcing the lock of a file prior to its commit.

Posted by Johan Appelgren <jo...@gmail.com>.
On 7/21/06, Luca Cappa <lu...@sequoia.it> wrote:
> On Thu, 20 Jul 2006 15:31:57 +0200, Johan Appelgren
> <jo...@gmail.com> wrote:
> >
> > Have you looked at writing a pre-commit hook that does what you want?
> >
> > That wouldn't stop anyone from editing a file, then get the lock and
> > then commit though. So I'm not sure what you'd gain?
>
> I would gain that the person needs to get the lock. If the lock is already
> being held
> by someone else, this guy is warned that the next time he removes the
> read-only flag
> (and changes it and then fails to lock it) he will remember to check if
> there is
> already any lock on that file prior to apply any modification to it.

But this will educate them after they spent countless hours modifying
a unmergable file that they then can't commit. I'd think it would be
better to teach them what the read-only flag for files mean before
they make that mistake?

/Johan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Enforcing the lock of a file prior to its commit.

Posted by Johan Appelgren <jo...@gmail.com>.
On 7/20/06, Luca Cappa <lu...@sequoia.it> wrote:
> Hello Greg,
>
> In Thu, 20 Jul 2006 14:54:12 +0200, Greg Thomas <th...@omc.bt.co.uk>
> wrote:
>
> > On Thu, 20 Jul 2006 09:37:18 +0200, "Luca Cappa"
> > <lu...@sequoia.it> wrote:
> >
> >> i am searching for a way to prevent that a not locked file could be
> >> committed. I think
> >> i could achieve that writing on my own a prehook script, but i am
> >> searching for a
> >> working out of the box solution. Any help?
> >
> > I may be missing something, but would
> >
> > svn propset svn:needs-lock yes /path/to/file
> >
> > do the job?
> >
>
> No, cause if you try it, you could commit a file with that property set
> even though you havent locked it. The trick is to just remove the
> read-only flag on that file, modify it and then commit it. Try it and you
> will see
> that locks as they are appear to be totaly useless.
>
>
> Luca
>
> p.s. Please do not start arguing about the meaning of the life and so on,
> i need that feature as i said (i would like to commit only if the file was
> prior locked by the commiter).

Have you looked at writing a pre-commit hook that does what you want?

That wouldn't stop anyone from editing a file, then get the lock and
then commit though. So I'm not sure what you'd gain?

/Johan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Enforcing the lock of a file prior to its commit.

Posted by Erik Huelsmann <eh...@gmail.com>.
> No, cause if you try it, you could commit a file with that property set
> even though you havent locked it. The trick is to just remove the
> read-only flag on that file, modify it and then commit it. Try it and you
> will see
> that locks as they are appear to be totaly useless.
>
>
> Luca
>
> p.s. Please do not start arguing about the meaning of the life and so on,
> i need that feature as i said (i would like to commit only if the file was
> prior locked by the commiter).

Actually, you do need to think about the meaning of life: You really
need to think about your real problem, because there is *no* guarantee
that if someone has locked a file which he modified locally that he
will be able to commit that file (by reversing the modify/lock steps).

If you have an old version of said binary file, there's no way that
file is going to enter the repository without trickery (trickery which
will destroy the modifications of the file in the repository).

bye,

Erik.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Enforcing the lock of a file prior to its commit.

Posted by Luca Cappa <lu...@sequoia.it>.
Hello Greg,

In Thu, 20 Jul 2006 14:54:12 +0200, Greg Thomas <th...@omc.bt.co.uk>  
wrote:

> On Thu, 20 Jul 2006 09:37:18 +0200, "Luca Cappa"
> <lu...@sequoia.it> wrote:
>
>> i am searching for a way to prevent that a not locked file could be
>> committed. I think
>> i could achieve that writing on my own a prehook script, but i am
>> searching for a
>> working out of the box solution. Any help?
>
> I may be missing something, but would
>
> svn propset svn:needs-lock yes /path/to/file
>
> do the job?
>

No, cause if you try it, you could commit a file with that property set  
even though you havent locked it. The trick is to just remove the  
read-only flag on that file, modify it and then commit it. Try it and you  
will see
that locks as they are appear to be totaly useless.


Luca

p.s. Please do not start arguing about the meaning of the life and so on,  
i need that feature as i said (i would like to commit only if the file was  
prior locked by the commiter).

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Enforcing the lock of a file prior to its commit.

Posted by Greg Thomas <th...@omc.bt.co.uk>.
On Thu, 20 Jul 2006 09:37:18 +0200, "Luca Cappa"
<lu...@sequoia.it> wrote:

>i am searching for a way to prevent that a not locked file could be  
>committed. I think
>i could achieve that writing on my own a prehook script, but i am  
>searching for a
>working out of the box solution. Any help?

I may be missing something, but would 

svn propset svn:needs-lock yes /path/to/file

do the job?

Greg
-- 
This post represents the views of the author and does
not necessarily accurately represent the views of BT.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org