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

Getting the username in the hook

From: emerson cargnin <echofloripa.yell_at_gmail.com>
Date: Thu, 31 Jul 2008 12:45:50 +0100

Hi

I have on my svn hook a script to run checkstyle and stop the commit
for some of the checks. It happens that I want to log also the
username trying to commit. At the momment this bit of the hook looks
like:

        echo "RUNNING CHECKSTYLE" >> $CHECKSTYLE_LOG
        CHANGED=`$SVNLOOK changed -t "$TXN" "$REPOS" | grep -v "^D" |\
                awk '{print $2}'`
        mkdir -p $TMPDIR
        X=0
        for LINE in $CHANGED ; do
           #echo $CHANGED >> $CHECKSTYLE_LOG
           FILE=`echo $LINE | egrep \\.java$ | egrep $INCLUDE | egrep -v
$EXCLUDE`
        
           if [ -n "$FILE" ] ; then
               $SVNLOOK cat $REPOS --transaction $TXN $FILE > $TMPDIR/tmpfile.java
               echo `date`-"RUNNING CHECKSTYLE FOR $CHANGED" >> $CHECKSTYLE_LOG
               $JAVA -jar $CHECKSTYLE -c $CHECKSTYLE_CONFIG $TMPDIR/tmpfile.java \
> $TMPDIR/tmpfile.checkstyle
               X=$(($X + $?))
               cat $TMPDIR/tmpfile.checkstyle |\
                   grep -v "^Starting audit...$\|^Audit done.$" |\
                   sed -e "s@$TMPDIR/tmpfile.java@$FILE@" \
>> $REPORT
               fi
        done
        if [ $X -ne 0 ] ; then
           cat $REPORT >> $CHECKSTYLE_LOG
           echo "For more information visit here:
http://wiki:8090/wiki/index.php/Checkstyle_Rules " >> $REPORT
           cat $REPORT > /dev/stderr
           rm -Rf $TMPDIR
           exit 1
        fi

Is there any variable that returns the username?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-07-31 13:46:14 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.