Stupid CVS tricks.
Juli Mallett
jmallett at FreeBSD.org
Mon Aug 11 00:11:31 PDT 2003
Below you'll find some over-mutilated Perl I did just now to produce
dot (as in, graphviz) format graphs for CVS logs, with a link from
each committer to each RCS file for every commit. With relatively
small data sets (fcvs-src rlog xargs, or kern_sig.c,v) this will produce
fairly interesting and meaningful figures. Looking at these things, I
get a fairly good feel for certain things, and you certainly can notice
a lot of patterns. Things aren't spaced out and evened out quite as
much as I'd like, but I have roughly zero cool on how to do that without
linking all the files to eachother, and the same of all committers.
%%%
#! /usr/bin/env perl
#
# CVS logs to dot format.
$curfileno = 0;
$cvslog = "cvs-log";
open(DATA, "<$cvslog") || die "$!";
print "digraph cvs {\n";
while (<DATA>) {
while (!/^RCS file:/) {
$_ = <DATA>;
}
if (/^date: /) {
$author = "$_";
$author =~ s/date: .* author: (.*) state: .*/$1/i;
$author =~ s/\;//g;
chomp $author;
if ($committers{"$author"} != 1) {
print "z" . $author . " [shape=rectangle,label=\"" . $author . "\"];\n";
$committers{"$author"} = 1;
}
print "z" . $author . " -> " . "z" . $curfileno . ";\n";
}
if (/^RCS file:/) {
$curfileno++;
$curfile = "$_";
$curfile =~ s/RCS file: //;
chomp $curfile;
print "z" . $curfileno . " [shape=hexagon,label=\"" . $curfile . "\"];\n";
}
}
print "};\n";
close(DATA);
%%%
Name it something like cvsdot.pl and invoke it like:
fcvs-src rlog src/sys/kern/kern_sig.c > cvs-log
perl cvsdot.pl | dot -Tpng > _.png
[view] _.png
Actually, kern_sig.c is a terrible idea, but there you go.
Thought some of you hackers might find this interesting!
Thanx,
juli.
--
juli mallett. email: jmallett at freebsd.org; efnet: juli; aim: bsdflata;
i have lost my way home early - i don't care cause i won't stay there.
More information about the freebsd-hackers
mailing list