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

Re: Fail commit if certain text in the commit

From: Nicolas Goutte <nicolasg_at_snafu.de>
Date: 2005-06-10 16:49:39 CEST

On Friday 10 June 2005 01:24, Steve Williams wrote:
> Christopher Ness wrote:
> > On Thu, 2005-06-09 at 10:44 -0400, Christopher Ness wrote:
> >>On Thu, 2005-06-09 at 17:57 +1000, Steve Williams wrote:
> >>>I have tried adding the following to the template pre-commit hook
> >>>(server running on RH9).
> >>>
> >>>if $SVNLOOK diff -t "$TXN" "$REPOS" | grep -i "nocommit" >/dev/null
> >>>then (echo "Contains nocommit keyword"; exit 1)
> >>>fi

As
doing something like:
( exit 1 ); echo $?

works, it means that "exit" only exit from the sub-shell not from the whole
script.

So you should try something like:

if $SVNLOOK diff -t "$TXN" "$REPOS" | grep -i "nocommit" >/dev/null ; then
  echo "Contains nocommit keyword"
  exit 1
fi

Have a nice day!

(...)
> Not sure how to echo to STDERR, but shouldn't the 'exit 1' make the
> pre-commit hook fail? It is not doing that, but that statement works as
> expected from the bash command-line.
>
> And yes, that keyword was chosen to be sure it did not already exist in
> any existing source code.

Have a nice day!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Jun 10 17:24:57 2005

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