You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Amitakhya Phukan <ap...@fedoraproject.org> on 2011/12/12 12:19:07 UTC

Pre commit hook script help needed

Hello all,

I have this issue with me. I have a SVN structure foo like this :

Foo
 |
 |
 |_____  Docs
 |
 |
 |
 |______  Bar


Now there is a pre-commit hook that checks for some conditions before
allowing commits into Foo. However, I want to exclude Docs folder/file from
this checking exercise. I want this checking to be implemented only for Bar
(and also for all the modules inside Bar, if there are any multiple modules
inside Bar). How do I achieve this ?

I am new to the whole SVN thing and also have no experience in scripting.

Please help.

----

Best regards,
Amitakhya Phukan

Re: Pre commit hook script help needed

Posted by Ryan Schmidt <su...@ryandesign.com>.
Remember to Reply All so the conversation stays on the mailing list.

On Dec 13, 2011, at 01:38, Amitakhya Phukan wrote:

> On Tue, Dec 13, 2011 at 2:22 AM, Ryan Schmidt wrote:
>> If you're using something like bash to write your post-commit hook script, you'll be running "svnlook changed" to see what files were changed by the revision, and then for each one, you'll be doing your check. In between those steps (getting the list of files, and checking them), filter out the ones you don't want to check (those in Docs). For example using "grep -v /Docs/". Alternately, discard everything *except* the paths you want to check, e.g. Bar: "grep /Bar/".
> 
> So I have to write a post commit hook ? Can you please share an example with me ? I am using bash shell.

Sorry, I meant pre-commit hook. They're quite similar anyway. There are many examples of hook scripts in the mailing list archives; you should be able to find some by searching:

http://svn.haxx.se/users/


Re: Pre commit hook script help needed

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Dec 12, 2011, at 05:19, Amitakhya Phukan wrote:

> I have this issue with me. I have a SVN structure foo like this :
> 
> Foo
>  |
>  |
>  |_____  Docs
>  |
>  |
>  |
>  |______  Bar
> 
> 
> Now there is a pre-commit hook that checks for some conditions before allowing commits into Foo. However, I want to exclude Docs folder/file from this checking exercise. I want this checking to be implemented only for Bar (and also for all the modules inside Bar, if there are any multiple modules inside Bar). How do I achieve this ?
> 
> I am new to the whole SVN thing and also have no experience in scripting.

If you're using something like bash to write your post-commit hook script, you'll be running "svnlook changed" to see what files were changed by the revision, and then for each one, you'll be doing your check. In between those steps (getting the list of files, and checking them), filter out the ones you don't want to check (those in Docs). For example using "grep -v /Docs/". Alternately, discard everything *except* the paths you want to check, e.g. Bar: "grep /Bar/".