Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Aug 2003 02:11:30 -0500
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        freebsd-hackers@freebsd.org
Subject:   Stupid CVS tricks.
Message-ID:  <20030811021130.A31451@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
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@freebsd.org; efnet: juli; aim: bsdflata;
i have lost my way home early - i don't care cause i won't stay there.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030811021130.A31451>