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

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

From: Res Pons <pons32_at_hotmail.com>
Date: 2007-03-23 21:35:18 CET

Ryan

Thank you for all your help. Yes one of my main problems was thinking that
$REPO is the fully qualified path of the transaction including both the svn
and the project path! I see that you modified the grep to
^testproject/trunk. I would've never thought of that thinking that $REPO
includes everythings! Now that I see the modifed script, I have a much
better understanding. As for -n in echo, what version of svn are you using
on your sever? I think our linux svn version is 1.4.

Thanks for all your help.

Rez

----Original Message Follows----
From: Ryan Schmidt <subversion-2007a@ryandesign.com>
To: Res Pons <pons32@hotmail.com>
CC: Subversion Users <users@subversion.tigris.org>
Subject: Re: SVN: pre-commit, I give up. Help!
Date: Fri, 23 Mar 2007 02:30:16 -0500

On Mar 23, 2007, at 02:02, Ryan Schmidt wrote:

>On Mar 23, 2007, at 01:06, Res Pons wrote:
>
>>GREP='/bin/grep'

Make sure this is where grep actually is on your system. On mine, it's in
/usr/bin/grep.

>> echo -n "You must start your comment with a bug
>>number, aborting..." 1>&2
>
>Why are you suppressing the newline with -n?

Ah, now that I've played with it a bit, I see that Subversion automatically
prints a newline at the end.

So, this is a version that seems to work for me:

#!/bin/bash

# A pre-commit hook script to ensure that no changes are commited to the
# repository without a valid log message.

REPO="$1"
TXN="$2"

SVNLOOK='/opt/local/bin/svnlook'
GREP='/usr/bin/grep'

$SVNLOOK dirs-changed -t "$TXN" "$REPO" | $GREP '^testproject/trunk/' >
/dev/null

if [ $? -eq 0 ]; then

        # For testproject, make sure that the comment starts with a (bug) number
        $SVNLOOK log -t "$TXN" "$REPO" | $GREP '^[[:digit:]]' > /dev/null

        if [ $? -ne 0 ]; then
                echo -n 'For this project, you must start your log message with a bug
number.' 1>&2
                exit 1
        fi

else

        # For other projects, no bug number necessary, just make sure the comment
isn't empty
        $SVNLOOK log -t "$TXN" "$REPO" | $GREP '[a-zA-Z0-9]' > /dev/null
        if [ $? -ne 0 ]; then
                echo -n 'You must enter some text in your log message.' 1>&2
                exit 1
        fi

fi

--
To reply to the mailing list, please use your mailer's Reply To All  
function
_________________________________________________________________
Interest Rates near 39yr lows! $430,000 Mortgage for $1,399/mo - Calculate 
new payment 
http://www.lowermybills.com/lre/index.jsp?sourceid=lmb-9632-18466&moid=7581
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Mar 23 21:35:41 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.