[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CVS notifications with meaningfull subject
From: |
Thomas S. Urban |
Subject: |
Re: CVS notifications with meaningfull subject |
Date: |
Tue, 27 Aug 2002 13:01:33 -0700 |
User-agent: |
Mutt/1.3.28i |
On Tue, Aug 27, 2002 at 07:02:44 +0200, Piet Verhoeve sent 0.5K bytes:
> We are successfully using the CVS watch option for monitoring common
> modules. In order to reduce the amount of emails the user has to open, I
> would like to send out notifications that have a variable subject line (e.g.
> the username or filename) instead of sending out notifications with the
> information stored only in the body of the mail.
>
> Any ideas ?
It's pretty easy with a script called by the notify mechanism, here are
some bits pruned out of the script I use (below). Something to start
with - further refinement is an exercise in perl (or whatever language),
not really a CVS question.
---------- begin cvsnotify.pl ----------
#!/usr/bin/perl
$CVSROOT = '/YOURCVSROOT'; # config
$watcher_address = shift @ARGV; # watch is single arg
@cvs_input = <>; # parse notify info passed in on stdin
chomp @cvs_input; # remove newlines
shift @cvs_input; # skip a line
shift @cvs_input; # skip a line
$module = shift @cvs_input; # better place to get module
$module =~ s/Triggered (\w+) watch on $CVSROOT\///;
$file =~ s/^$module //;
$line = shift @cvs_input; # changed by - should be the same
($nop, $changer) = split (' ',$line);# as the email sender
$rlog_file = $CVSROOT . '/' . $module . '/' . $file . ',v';
# then do something with this info, e.g., put the changer, file, and
# module in the subject line:
open (MAIL, "| mail -s '$changer changed $file in $module' $watcher_address");
print MAIL "interesting things can be done by looking at the rcs file\n";
close MAILINP;
---------- end cvsnotify.pl ----------
Make sure CVS is set up to use the script, for starters:
---------- begin CVSROOT/notify ----------
ALL /PATHTO/cvsnotify.pl %s
---------- end CVSROOT/notify ----------
--
Nobody knows the trouble I've been.