You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by David Aldrich <Da...@EU.NEC.COM> on 2010/06/03 14:12:00 UTC

Wanted: pre-commit hook to prevent commits to externals definition

Hi

Please can anyone point me to an example of a svn pre-commit hook that prevents commits to files that are members of an externals definition?

We want to allow such files to be committed only from within the external directory, i.e. where they originate from.

Best regards

David

RE: Wanted: pre-commit hook to prevent commits to externals definition

Posted by David Aldrich <Da...@EU.NEC.COM>.
Hi Ryan and Daniel

> Right. I don't think the server would be able to tell that a commit came
> from a working copy that, on the client side, had been created by an
> externals definition. I think it all looks the same to the server so I
> don't think such a hook script can be implemented.

Thank you both for your answers.

Best regards

David

Re: Wanted: pre-commit hook to prevent commits to externals definition

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 3, 2010, at 18:34, Daniel Becroft wrote:

> On Fri, Jun 4, 2010 at 12:12 AM, David Aldrich <Da...@eu.nec.com> wrote:
> 
>> Please can anyone point me to an example of a svn pre-commit hook that prevents commits to files that are members of an externals definition?
>> 
>> We want to allow such files to be committed only from within the external directory, i.e. where they originate from.
> 
> I don't have an example of such a script. *But*, I'm not sure if even such a script could be possible. My understanding of committing w/ externals, is that the modifications to the externals are committed separately (or even excluded) from the main commit. This would certainly be the case for externals pointing to a separate repository, and may be the case .
> 
> I just did a quick test (with both intra- and inter-repository external definitions), and SVN does not seem to descend into the externals for a commit. The externals directory has to be explicitly committed, which makes it no different from a normal working copy. 

Right. I don't think the server would be able to tell that a commit came from a working copy that, on the client side, had been created by an externals definition. I think it all looks the same to the server so I don't think such a hook script can be implemented.


Re: Wanted: pre-commit hook to prevent commits to externals definition

Posted by Daniel Becroft <dj...@gmail.com>.
On Fri, Jun 4, 2010 at 12:12 AM, David Aldrich <Da...@eu.nec.com>wrote:

> Hi
>
> Please can anyone point me to an example of a svn pre-commit hook that
> prevents commits to files that are members of an externals definition?
>
> We want to allow such files to be committed only from within the external
> directory, i.e. where they originate from.
>
> Best regards
>
> David
>

I don't have an example of such a script. *But*, I'm not sure if even such a
script could be possible. My understanding of committing w/ externals, is
that the modifications to the externals are committed separately (or even
excluded) from the main commit. This would certainly be the case for
externals pointing to a separate repository, and may be the case .

I just did a quick test (with both intra- and inter-repository external
definitions), and SVN does not seem to descend into the externals for a
commit. The externals directory has to be explicitly committed, which makes
it no different from a normal working copy.

Cheers,

Re: Wanted: pre-commit hook to prevent commits to externals definition

Posted by Lorenz <lo...@yahoo.com>.
Daniel Becroft wrote:
>Lorenz wrote:
>> David Aldrich wrote:
>>>Please can anyone point me to an example of a svn pre-commit hook that prevents commits
>>>to files that are members of an externals definition?
>>>
>>>We want to allow such files to be committed only from within the external directory, i.e. where
>>>they originate from.
>>
>> As long as the externals are pointing to the same repository it should
>> be possible to examine the transaction and determine if any of the
>> changed paths is related to an external definition (external
>> properties can be extracted from the transaction too).
>
>Really? From my testing, it seemed that SVN doesn't descend into
>externals during a commit, regardless of whether the external points
>to the same or a different repository.
>
>Have you seen different behaviour?

yes and no 8-)

The command line client does not decend into externals, but you can
list the external folders additionally to get an atomic commit,

and I'm using TSVN as my main client, which lists externals from the
same repository in the commit dialog, selected for commit by default.
-- 

Lorenz

Re: Wanted: pre-commit hook to prevent commits to externals definition

Posted by Daniel Becroft <dj...@gmail.com>.
On Mon, Jun 7, 2010 at 6:52 PM, Lorenz <lo...@yahoo.com> wrote:
> David Aldrich wrote:
>>Please can anyone point me to an example of a svn pre-commit hook that prevents commits
>>to files that are members of an externals definition?
>>
>>We want to allow such files to be committed only from within the external directory, i.e. where
>>they originate from.
>
> As long as the externals are pointing to the same repository it should
> be possible to examine the transaction and determine if any of the
> changed paths is related to an external definition (external
> properties can be extracted from the transaction too).

Really? From my testing, it seemed that SVN doesn't descend into
externals during a commit, regardless of whether the external points
to the same or a different repository.

Have you seen different behaviour?

Cheers,
Daniel B.

Re: Wanted: pre-commit hook to prevent commits to externals definition

Posted by Lorenz <lo...@yahoo.com>.
David Aldrich wrote:
>Please can anyone point me to an example of a svn pre-commit hook that prevents commits
>to files that are members of an externals definition?
>
>We want to allow such files to be committed only from within the external directory, i.e. where
>they originate from.

As long as the externals are pointing to the same repository it should
be possible to examine the transaction and determine if any of the
changed paths is related to an external definition (external
properties can be extracted from the transaction too).
-- 

Lorenz