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

Re: pre-commit hook

From: Ryan Schmidt <subversion-2006Q1_at_ryandesign.com>
Date: 2006-02-27 21:06:51 CET

On Feb 27, 2006, at 06:32, Kenneth P. Turvey wrote:

>> Where are you looking for the echo? The echo will not show up
>> client-side because the script is called by the server process.
>
> I'm running Linux. There isn't any server. I'm running against a
> local
> repository. The URL I'm using is:
>
> file:///home/kt/subversion/WhateverDirectory

Still, I don't believe the "echo" statement in the hook script will
show up anywhere, unless you redirect its output to a logfile and
then check the logfile later.

> #!/bin/sh
> ########################
> # repository
> ########################
> REPOS="$1"
> # Transaction
> TXN="$2"
> ########################
> #debug
> ########################
> #transaction=`$SVNLOOK changed -t $TXN $REPO`
> #echo "$transaction";
> echo This should be printed out
> ##########################
> # user 'god' can do anything
> ##########################
> # User=`svnlook author -t $TXN $REPOS`
> # if ( $User == "god" ){ exit 0 }
> #################################
> # Log message contains some text.
> #################################
> SVNLOOK=/usr/bin/svnlook
> $SVNLOOK log -t "$TXN" "$REPOS" | \
> grep "[a-zA-Z0-9]" > /dev/null || exit 1
> ########################
> # Protect tags directory
> ########################
> # Deny transaction if any line writes to tags directory that exists.
> # tags dir match pattern
> TAGS_REGEX='tags/[^/]\+'
> # Get list of transactions in the 'tag' directory
> TAGS_CHANGES=`"$SVNLOOK" changed -t "$TXN" "$REPOS" 2>/dev/null | \
> awk '{ print $2; }' 2>/dev/null | \
> grep ^tags/ 2>/dev/null | \
> sed -e "s!^\($TAGS_REGEX\).*!\1!" | \
> sort | \
> uniq`
> # Get head revision number
> YOUNGEST=`svnlook youngest "$REPOS" 2>/dev/null`

You've forgotten to use $SVNLOOK here.

> # For every line in transaction,
> # check to see if directory in tags exists
> for CHANGE in $TAGS_CHANGES; do
> # If directory in tags exists, deny transaction
> if svnlook proplist -r $YOUNGEST "$REPOS" "$CHANGE" >/dev/null
> 2>&1 ;

And here.

> then
> echo "Cannot modify existing tag: ${tag}" >&2
> exit 1
> fi
> done
> #######################
> # Allow transaction
> #######################
> exit 0

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Feb 27 21:39:54 2006

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