You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Grant Rettke <gr...@acm.org> on 2006/09/08 21:42:42 UTC

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

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;

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

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

Posted by Grant Rettke <gr...@acm.org>.
Quoting Andy Levy <an...@gmail.com>:

> On 9/8/06, Grant Rettke <gr...@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?

> 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/

Thanks Andy, I'm all for not reinventing the wheel.

I'm not familar with that script. Have you personally used that script
to solve the problem I described?


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

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

Posted by Andy Levy <an...@gmail.com>.
On 9/8/06, Grant Rettke <gr...@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