You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "A. M. Passy" <am...@gmail.com> on 2007/08/07 15:14:22 UTC

start-commit to enforce needs-lock?

I'm looking for a way to enforce the setting of the svn:needs-lock
property for new and imported files.  I've read the appropriate
sections of the svnbook and read a whole lot of the mailing list
traffic.  I understand that using a pre-commit hook is considered bad,
because one is modifying an in-process transaction (though as an
aside, no one has explained exactly under what conditions, i.e._why_
it is bad - the comments are all in the mode of "there be dragons").

But I notice that there is the "start-commit" hook, which happens
before the transaction is created.  What's wrong with adding the
property if not present at that point?

BTW - I've read all the arguments for the supported models of source
control, Lock-Modify-Unlock, and Copy-Modify-Merge, and for reasons
that mainly relate to our userbase, we're going with the
Lock-Modify-Unlock model.

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

Duplicate Tag creation stop script

Posted by "Patwardhan, Rajesh" <ra...@etrade.com>.
Hi,

Thank you very much for taking the time to read my email.

I had a quick question. 
I know there was a script which could be plugged into the pre-commit
hook in subversion to 
1/ stop accidental run of the tag creation command. 
2/ stop checkin on tags directory. 

So it would only allow a creation of a tag in the tags directory and
subsequent run of the same command would not allow creation of a
unwanted directory in the intended tag directory. 


For e.g
svn copy http://myserver/svn/mymodule/branches/my_branch/
http://myserver/svn/mymodule/tags/my_tag -m"Good message" 

Now the script I am hoping existed would not allow rerun of the above
command as also this could be achieved by stopping a checkin into a tag
if it already existed.  

Could someone please point me in the right direction. 

Regards,
Rajesh 

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


Re: start-commit to enforce needs-lock?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Aug 7, 2007, at 10:57, Andy Levy wrote:

> On 8/7/07, A. M. Passy wrote:
>
>> But I notice that there is the "start-commit" hook, which happens
>> before the transaction is created.  What's wrong with adding the
>> property if not present at that point?
>
> I would think the same dangers lurk here. You're still changing the
> content that's been transmitted by the client without notifying the
> client.

No, at the start-commit phase, the client has not yet transmitted any  
data to the server other than the username and password, so there is  
no way to affect the transaction at this point, since there isn't yet  
any transaction.


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

Re: start-commit to enforce needs-lock?

Posted by "Srilakshmanan, Lakshman" <la...@police.vic.gov.au>.
In addition to what Dave wrote below, you could depending on your
client, set your client configuration to add svn:needs-lock
automatically to the files when the user performs a client side add
command. 

We use TortoiseSVN but I can't speak for all svn clients.

Thanks
Lakshman

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of Dave Lawrence
Sent: Wednesday, 8 August 2007 2:58 AM
To: users@subversion.tigris.org
Subject: Re: start-commit to enforce needs-lock?

Andy Levy wrote:
> On 8/7/07, A. M. Passy <am...@gmail.com> wrote:
>> I'm looking for a way to enforce the setting of the svn:needs-lock 
>> property for new and imported files.  I've read the appropriate 
>> sections of the svnbook and read a whole lot of the mailing list 
>> traffic.  I understand that using a pre-commit hook is considered 
>> bad, because one is modifying an in-process transaction (though as an

>> aside, no one has explained exactly under what conditions, i.e._why_ 
>> it is bad - the comments are all in the mode of "there be dragons").
> 
> It's bad because (and this is only one of several reasons, I'm sure) 
> if a hook modifies a transaction in-flight, the WC is out of sync with

> the repository immediately after the transaction is committed. If I 
> commit a file to the repository, upon completion of the transaction, 
> my copy of the file should be identical in all ways to the copy in the

> repository.

My understanding is that the correct thing to do is to use the
pre-commit hook to validate the commit, and reject it if it doesn't
conform.  The user receives an error and the ball is now back in their
court - they must add the needs-lock property and try again.

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



=======================================================
The information contained in this email and any files attached may
be confidential information to the intended recipient and may be
the subject of legal professional privilege or public interest immunity.

If you are not the intended recipient, any use, disclosure or copying is
unauthorised.

If you have received this document in error please telephone 1300 307 082

*******************************************************************
This footnote also confirms that this email message has been swept
for the presence of computer viruses.
*******************************************************************

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


Re: start-commit to enforce needs-lock?

Posted by Dave Lawrence <dl...@ad-holdings.co.uk>.
Andy Levy wrote:
> On 8/7/07, A. M. Passy <am...@gmail.com> wrote:
>> I'm looking for a way to enforce the setting of the svn:needs-lock
>> property for new and imported files.  I've read the appropriate
>> sections of the svnbook and read a whole lot of the mailing list
>> traffic.  I understand that using a pre-commit hook is considered bad,
>> because one is modifying an in-process transaction (though as an
>> aside, no one has explained exactly under what conditions, i.e._why_
>> it is bad - the comments are all in the mode of "there be dragons").
> 
> It's bad because (and this is only one of several reasons, I'm sure)
> if a hook modifies a transaction in-flight, the WC is out of sync with
> the repository immediately after the transaction is committed. If I
> commit a file to the repository, upon completion of the transaction,
> my copy of the file should be identical in all ways to the copy in the
> repository.

My understanding is that the correct thing to do is to use the 
pre-commit hook to validate the commit, and reject it if it doesn't 
conform.  The user receives an error and the ball is now back in their 
court - they must add the needs-lock property and try again.

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

Re: start-commit to enforce needs-lock?

Posted by Andy Levy <an...@gmail.com>.
On 8/7/07, A. M. Passy <am...@gmail.com> wrote:
> I'm looking for a way to enforce the setting of the svn:needs-lock
> property for new and imported files.  I've read the appropriate
> sections of the svnbook and read a whole lot of the mailing list
> traffic.  I understand that using a pre-commit hook is considered bad,
> because one is modifying an in-process transaction (though as an
> aside, no one has explained exactly under what conditions, i.e._why_
> it is bad - the comments are all in the mode of "there be dragons").

It's bad because (and this is only one of several reasons, I'm sure)
if a hook modifies a transaction in-flight, the WC is out of sync with
the repository immediately after the transaction is committed. If I
commit a file to the repository, upon completion of the transaction,
my copy of the file should be identical in all ways to the copy in the
repository.

It's been discussed on the list numerous times, I'm surprised you
didn't find anything beyond "don't do that."

> But I notice that there is the "start-commit" hook, which happens
> before the transaction is created.  What's wrong with adding the
> property if not present at that point?

I would think the same dangers lurk here. You're still changing the
content that's been transmitted by the client without notifying the
client.

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