开发者

SVNNotify: Do not send notification email when a special keyword is present in the svn log message

I am using SVNNotify to send post-commit notification messages. Sometimes I do a typo and I want to commit again but I do NOT want to bombard my users with yet another unimportant email message. So It would 开发者_开发技巧be nice to have a special directive to tell SVNNotify that it does NOT need to send any email this time. Something sent through the svn log message:

svn commit -m 'Typo (_no_email_)'

So SVNNotify would parse _no_email_ and understand that it does NOT need to notify this time.

Does anyone know PERL and/or SVNNotify to perform such a hack on Notify.pm?

Thanks !!!


You can just add the following line on /usr/local/share/perl/5.10.1/SVN/Nofity.pm:

# Abort if log message ends with _
exit if ($self->{message}[0] =~ /_\s*$/);

On line 1299 inside this loop:

# Add the first sentence/line from the log message.
unless ($self->{no_first_line}) {

    # Abort if log message ends with _
    exit if ($self->{message}[0] =~ /_\s*$/);

    # Truncate to first period after a minimum of 10 characters.
    my $i = index substr($self->{message}[0], 10), '. ';
    $self->{subject} .= $i > 0
        ? substr($self->{message}[0], 0, $i + 11)
        : $self->{message}[0];
}


SVN::Notify has a way to create custom filters. Have a look at the documentation for SVN::Notify::Filter. It looks pretty straightforward and there are many examples.

perldoc SVN::Notify::Filter
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜