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

SVN: pre-commit, I give up. Help!

From: Res Pons <pons32_at_hotmail.com>
Date: 2007-03-23 07:06:36 CET

Hi everyone

I give up. My new pre-commit script does not work. I even included a final
echo stmt and an exit code of 1 to cause it failure but when I check out the
"testproject" and another project, I can, in either project, do [svn ci -m
"comment" . ] and svn continues regardless and checks in the file anyway as
seen below:

Transmitting file data .
Committed revision 234.

Here's a copy of my pre-commit:

sudo vi pre-commit

#!/bin/bash
# A pre-commit hook script to ensure that no changes are commited to the
# repository without a valid comment
#

REPO="$1"
TXN="$2"
SVNLOOK='/usr/bin/svnlook'
GREP='/bin/grep'
TESTPROJECT=`echo $REPO | $GREP '/testproject/trunk/'`
RESULT=$?

        if [[ "$TESTPROJECT" ]]; then

                #make sure that the comment starts with a bug number and
contains some text.
                $SVNLOOK log -t "$TXN" "$REPO" | $GREP '^[[:digit:]]' >
/dev/null
                result=$?

                if [[ $result -ne 0 ]]; then

                        echo -n "You must start your comment with a bug
number, aborting..." 1>&2
                        exit 1

                fi

        elif [[ "$TESTPROJECT" = "" ]]; then

                #if the project is non-testproject, no bug# necessary, just
force an alphanum comment
                $SVNLOOK log -t "$TXN" "$REPO" | $GREP "[a-zA-Z0-9]" >
/dev/null
                result=$?

                if [[ $result -ne 0 ]]; then

                        echo -n "You must enter an alphanumeric comment,
aborting..." 1>&2
                        exit 1

                fi

        else

                echo "Submission was successful." 1>&2
                exit 0

        fi

echo "WTF?" 1>&2
exit=1

_________________________________________________________________
5.5%* 30 year fixed mortgage rate. Good credit refinance. Up to 5 free
quotes - *Terms
https://www2.nextag.com/goto.jsp?product=100000035&url=%2fst.jsp&tm=y&search=mortgage_text_links_88_h2a5d&s=4056&p=5117&disc=y&vers=910

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Mar 23 07:07:02 2007

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.