Running OpenSolaris wdiff.pl on FreeBSD

The wdiff.pl script is a very cool Perl script, which is part of the OpenSolaris source. It runs diff(1) on two files, parses its output, and generates an HTML page which highlights the source code changes/differences between two files.

The “wdiff” utility it called by webrev (another OpenSolaris utility), to generate html pages for every file affected by a commit/changeset.

As part of an effort to port “webrev” to work with Mercurial on on FreeBSD, I had to make a small change to “wdiff.pl” earlier today. Here’s the output of wdiff running on itself:

http://people.freebsd.org/~keramida/wdiff/wdiff.pl.html

As part of a test to see how the modified “wdiff” would run on FreeBSD sources, I used a changeset from a Mercurial clone of the FreeBSD src tree too. The changeset I used as an example was:

changeset:   130135:d6862f5b2c5e
tag:         tip
user:        wkoszek
date:        Sat Mar 31 15:43:06 2007 +0000
files:       sys/netgraph/ng_base.c
description:
We don't need spinning locks here. Change them to the adaptive mutexes.
This change should bring no performance decrease, as it did not in my
tests.

Reviewed by:    julian, glebius
Approved by:    cognet (mentor)

and the resulting wdiff HTML page is oneline at:

http://people.freebsd.org/~keramida/wdiff/ng_base.c.html

The new “wdiff” seems to work fine so far. Now off to port the rest of “webrev” to FreeBSD. Who knows, maybe if things aren’t very difficult, I may even port “webrev.sh” to work with GNU bash(1), instead of ksh(1) ;-)