[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: Steve Williams <stevewilliams_at_kromestudios.com>
Date: 2005-06-10 01:24:52 CEST

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)
>>>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.

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.

This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect.

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Jun 10 01:40:37 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.