Procmail recipes to create FreeBSD cvsweb links for commit messages
Copyright © 2000-2003 by Doug Barton, DougB@FreeBSD.org
Hoek gets the credit for the idea and most of the code. I turned his stuff into a stand-alone recipe. If anyone wants to turn this into a FAQ entry, feel free.
:0
* ^X-FreeBSD-CVS-Branch:
* ^Subject: cvs commit:
{
# URLify
PERLSCRIPT='
while (<>) {
if (/^\s+(\d+\.)+\d+\s+\+\d+ \-\d+\s+/) {
$r = $_;
$r =~ s/.*?([a-z]+\/.+)/http\:\/\/www.FreeBSD.org\/cgi\/cvsweb\.cgi\/\1/;
$l = "$l$r";
}
print "$_";
}
print "$l";
'
:0 bf
| perl -Te "${PERLSCRIPT}"
}
Here is a modified version which creates URL's which take advantage of cvsweb's ability
to diff between two versions. For example:
http://www.FreeBSD.org/cgi/cvsweb.cgi/src/usr.sbin/sendmail/Makefile.diff?&r1=1.21&r2=1.22
I have also added a PR detector to print out the URL to the PR if one is included.
More recently, I've updated the header match to reflect the recent changes to CVS, and updated the code slightly to better handle the creation of new files, and deletion of old ones.
:0
* ^X-FreeBSD-CVS-Branch:
* ^Subject: cvs commit:
{
PERLSCRIPT='
while (<>) {
if (/^\s+PR\:[^\d]+(\d+)/) {
chomp; print "$_ http://www.FreeBSD.org/cgi/query-pr.cgi?pr=$1\n"; next;
}
if (/^\s+[\d\.]+\s+\+\d+\s+\-\d+\s+(.*)\s+\((dead|new)\)/) {
$l .= "http\:\/\/www\.FreeBSD\.org\/cgi\/cvsweb\.cgi\/$1\n";
} elsif (/^\s+([\d\.]+)\.(\d+)\s+\+\d+\s+\-\d+\s+(.*)/) {
$l .= "http\:\/\/www\.FreeBSD\.org\/cgi\/cvsweb\.cgi\/$3\.diff\?\&r1\=$1\." .
($2 - 1) . "\&r2\=$1\.$2\&f\=h\n";
}
print;
}
print "$l\n" if ($l);
'
:0 bf
| perl -Te "${PERLSCRIPT}"
}
Enjoy,