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

Re: pre-commit hook returns 409 failure

From: Maddes <maddes_svnlists_at_arcor.de>
Date: 2007-09-16 02:48:09 CEST

I now what you are looking for, and it is fairly easy with some
scripting knowledge.

My pre-commit hook looks like the following on Linux, where I also do
all the checks possible and only exit at the end, as I don't want the
user to commit and get the first error, commit again and get the second
error, and so on, that's why I "add" the errors.

declare -i RC_ALL=0

# Make sure that the log message contains some text.
$SVNLOOK log -t "$TXN" "$REPOS" | \
   grep "[a-zA-Z0-9]" > /dev/null \
   || { RC_ALL+=1; echo -e "$0:\nLog message empty!!!\n " 1>&2; }

...

# All checks done
echo All checks done. RC=${RC_ALL} 1>&2

# Enable next line when testing
#RC_ALL=999

exit ${RC_ALL}

Regards
Matthias "Maddes" Bücher
http://www.maddes.net/

On 15.09.2007 22:19, Jette Derriche wrote:
> On Sat, 2007-09-15 at 11:01 -0700, Karl Fogel wrote:
>> Jette Derriche <jette@nerdgirl.dk> writes:
>>> I have this hook based on the template that comes with subversion:
>> You have an unconditional "exit 1" on a line by itelf, unless your
>> mailer has wrapped lines and shown us something different from what
>> your hook actually looks like.
>
> My mail client did that...
>
> /Jette
>
>> -Karl
>>
>>> ------------------------------------------------
>>> #!/bin/sh
>>> REPOS="$1"
>>> TXN="$2"
>>>
>>> # Make sure that the log message contains some text.
>>> SVNLOOK=/usr/local/bin/svnlook
>>> $SVNLOOK log -t "$TXN" "$REPOS" | \
>>> grep "[a-zA-Z0-9]" > /dev/null || exit 1
>>>
>>> # Check that the author of this commit has the rights to perform
>>> # the commit on the files and directories being modified.
>>> #commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg ||
>>> exit 1
>>>
>>> # All checks passed, so allow the commit.
>>> exit 0
>>> ------------------------------------------------
>>>
>>> This is what I get when I commit with an empty message:
>>>
>>> ------------------------------------------------
>>> svn: Commit failed (details follow):
>>> svn: Commit failed (details follow):
>>> svn: 'pre-commit' hook failed with error output:
>>> svn: MERGE of '/path/to/directory': 409 Conflict
>>> (http://svn.example.com)
>>> ------------------------------------------------
>>>
>>> Of cause the commit should fail since I didn't supply a message. But the
>>> 409 error isn't very user friendly... I would like it to tell the user
>>> that he should supply a message...
>>>
>>> How do I do that?
>>>
>>> Here's some version info:
>>> Apache 2.2.3
>>> Subversion 1.4.3 (on both client and server)
>>> PHPeclipse 3.2.0
>>>
>>>
>>> Thanks :-)
>>>
>>> /Jette
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
>>> For additional commands, e-mail: users-help@subversion.tigris.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sun Sep 16 02:44:39 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.