On Aug 25, 2006, at 01:15, Ryan Schmidt wrote:
> On Aug 24, 2006, at 23:16, Young, Jason (GE Indust, GE Fanuc) wrote:
>
>> We have a user here that watches the revision numbers, and when it's
>> 1000, 2000, 3000, etc, he'll just change one character in the
>> file, and
>> then check it in. Does anyone have a post-commit script for Windows
>> that can check if the revision is divisible by 1000 and checked in
>> by a
>> certain person? I want those commits to fail, so that he can no
>> longer
>> steal the glory.
>
> Ha! Brilliant. :-)
>
> Here's a pre-commit hook for Unix/Linux/Mac OS X. (Sorry; I'm not
> up on Windows programming, but it should be easy enough to convert
> this to Perl or a batch file.)
>
> Note that the revision number isn't assigned until after the pre-
> commit hook ends. So it's possible that a banned author could still
> commit the banned revision if someone else is committing something
> else at the same time and that other revision gets handled first.
Let's try again without the debugging code and in a probably faster
order:
#!/bin/sh
##### begin configuration section #####
BANNED_AUTHORS="larry curly moe"
BANNED_DIVISOR=1000
SVNLOOK=/opt/local/bin/svnlook
##### end configuration section #####
REPO="$1"
TXN="$2"
HEAD_REV=`$SVNLOOK youngest "$REPO"`
NEXT_REV=$(($HEAD_REV+1))
IS_OK_REV=$(($NEXT_REV%$BANNED_DIVISOR))
if [ $IS_OK_REV -ne 0 ]
then
exit 0
fi
AUTHOR=`$SVNLOOK author -t "$TXN" "$REPO"`
IS_OK_AUTHOR=1
for BANNED_AUTHOR in $BANNED_AUTHORS
do
if [ "$AUTHOR" = "$BANNED_AUTHOR" ]
then
IS_OK_AUTHOR=0
fi
done
if [ $IS_OK_AUTHOR -ne 0 ]
then
exit 0
fi
echo "$AUTHOR may not commit revision $NEXT_REV" 1>&2
exit 1
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Aug 25 01:25:08 2006