[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: Christopher Ness <chris_at_nesser.org>
Date: 2005-06-09 16:58:46 CEST

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
> >
> > but it doesn't seem to catch the keyword. Is it my Bash scripting (i'm
> > a total newbie to Bash) or my use of the pre-commit hook? The
> > pre-commit hook currently works for catching empty log messages, but I
> > have no idea why this one is not working.

Ahem, replying to myself. You mean the "keyword" that is in the file
itself and not a meta-data property. Didn't get two coffees into me,
sorry.

This method makes the strong assumption that developers will not have
files with the string "nocommit" already committed to the repository.
That's the nature of the diff command.

Seems like it should work from the bash end, but you need to echo your
message to STDERR for the client to see it upon rejection.

Cheers,
Chris

-- 
Wireless Group,
McMaster University
finger.localdomain
10:47:31 up 1:36, 1 user, load average: 0.01, 0.03, 0.00
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Jun 9 17:02:28 2005

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.