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

Re: How to force comments on SVN commit

From: Ryan Schmidt <subversion-2009b_at_ryandesign.com>
Date: Thu, 28 May 2009 17:32:05 -0500

On May 28, 2009, at 15:08, Dave Peters wrote:

> I got the following errors when I commit the changes:
>
> Error: Commit failed (detailed follow):
> Error: MERGE request failed on 'Support/code/Dev'
> Error: 'pre-commit' hook failed with error output
>
>
> *************************
> Here is the pre-commit file:
> !/bin/sh
>
> REPOS="$1"
> TXN="$2"
>
> SVNLOOK=/usr/bin/svnlook
>
> LOGMSG=`$SVNLOOK log -t $TXN $REPOS | grep [a-zA-Z0-9] | wc -c`
>
> if [ "$LOGMSG" -lt 5 ]; then
> echo -e Please provide a meaningful comment when committing
> changes.. 1>&2
> exit 1
> fi
>
> commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg
> || exit 1
>
> exit 0

Not only do you need to use the full path to svnlook as you do, but
you also need to use the full path to any other binary or script you
use, including grep, wc and commit-access-control.pl. Remember that
PATH is empty while the hook script runs so it doesn't know where to
find anything.

echo is a shell built-in so you shouldn't need to use a full path for
that.

Also, maybe this was just a copy/paste error, but the first line of
the script must begin with "#!" not just "!".

Finally, make sure the script is called "pre-commit" (with no
extension) and has execute permission, for example use "chmod 755 pre-
commit".

So:

#!/bin/sh

REPOS="$1"
TXN="$2"

SVNLOOK=/usr/bin/svnlook
GREP=/usr/bin/grep
WC=/usr/bin/wc

LOGMSG=`$SVNLOOK log -t $TXN $REPOS | $GREP [a-zA-Z0-9] | $WC -c`

if [ "$LOGMSG" -lt 5 ]; then
echo -e Please provide a meaningful comment when committing changes..
1>&2
exit 1
fi

#commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg
|| exit 1

exit 0

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2356605

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-05-29 00:33:08 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.