[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: How to write a pre-commit hook script that disallows UAD to project tags?

From: Andy Levy <andy.levy_at_gmail.com>
Date: 2006-09-09 02:43:07 CEST

On 9/8/06, Grant Rettke <grettke@acm.org> wrote:
> Hi,
>
> I've got a pre-commit hook script (in perl) that prohibits updates and
> deletes to project tags. What I would really love is to have one script
> that allows folks to ADD to a project tag only once, and never add
> anything again after that.
>
> Do you think it would be possible to do so in a single script?
>
> I have yet to look deeply into this.
>
> Here is my current script for disallowing updates and deletes.
>
> $repository = $ARGV[0];
> $transaction = $ARGV[1];
>
> $svnlook = "/usr/bin/svnlook";
>
> $change_cmd = $svnlook . " changed " . $repository . " -t " . $transaction;
>
> @changes = `$change_cmd`;
>
> foreach $change (@changes) {
> if( $change =~ /^[UD]\W+.+\/tags\// )
> {
> print STDERR
>
> "\n***\n" .
> "\nUpdates and deletes to project tags are forbidden.\n" .
> "\nPlease contact your repository administrator if you have " .
> "any questions or concerns about this policy.\n" .
> "\n***\n";
>
> exit 1;
> } }
>
> exit 0;

Have you looked at svnperms.py yet? It may be able to help you out.
Why reinvent the wheel?
http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Sep 9 02:44:34 2006

This is an archived mail posted to the Subversion Users mailing list.