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

Re: Hooks scripts

From: John Peacock <john.peacock_at_havurah-software.org>
Date: Thu, 14 Feb 2008 13:26:11 -0500

Proskurin Kirill wrote:
> They what to deny commit without a comment. Only commit with comment
> accepted. As im understand for this im must use a hooks scripts.

You can take the default pre-commit.tmpl file inside the hooks directory
and rename it to pre-commit and make it executable.

Here's another way to do it, in case you want to do additional
processing, like make sure that there are ticket numbers (some knowledge
of Perl required).

=========================================
#!/usr/bin/perl

use strict;
my $repos = shift;
my $txn = shift;

my $SVNLOOK = '/usr/bin/svnlook';
my $message = `$SVNLOOK log -t $txn $repos`;

my $logcheck = $message;
$logcheck =~ s/\s+//mg;
if (!length($logcheck)) {
   print STDERR "\nEmpty commit messages are not allowed";
   exit 1;
}
# perform any other analysis on $logcheck
# return 0 for success or 1 for failure

exit 0; # always exit 0 at the end to indicate success
=========================================

HTH

John

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-02-14 19:26:31 CET

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.