I knocked this up for home use. It outputs your subversion log a bit nicer than plain text. Maybe it'll be helpul for some of the esteemed monks?

Update
Added use CGI::Carp qw(fatalsToBrowser), as suggested by ghenry.
#!/usr/bin/perl -w # # subvert.pl: display your change log from subversion use strict; use CGI qw(:standard ); use CGI::Carp qw(fatalsToBrowser); # For better error messages (Thanks +, ghenry) my $WORK_DIR='/var/www'; # location of directory that's currently chec +ked out my $start = param('start') || 'BASE'; my $end = param('end') || 'HEAD'; validate(); print header(), start_html({-style=>'/stylesheets/subvert.css',-title=>"SUBVER +t"}), h1("SUBVERt: Subversion Log Viewer"); print h2("Showing Revisions From: $start to $end"); print form(); print showlog(); print form(); print end_html(); # validate start and end params sub validate() { for ($start,$end) { next if ($_ eq "BASE" || $_ eq "HEAD" || $_ eq "PREV" +|| $_ eq "COMMITTED"); $_=~s/[^\d]//gi; } } # builds the submit form sub form() { my $return=""; $return.=start_form({-method=>"post"}); $return.="Search repository from revision: "; $return.=textfield({-name=>"start"},"$start"); $return.=" &nbsp; to revision: "; $return.=textfield({-name=>"end"},"$end"); $return.=" &nbsp; &nbsp; " . submit(-value=>" GO "); $return.=end_form(); return div({-class=>"frm"},$return); } # loop through the log splitting it into entries sub showlog() { my $return=""; my $log = `svn log $WORK_DIR -r $start:$end` ; my @log = split /[-]{10,}/,$log; for (my $i=1;$i<$#log;$i++){ $return.=parse_entry($log[$i]); } return $return; } # parse log entry and give it back as html sub parse_entry() { my @entry = split /\n/,@_[0]; my ($revision,$author,$date,$cmt_length) = split /\|/,$entry[1 +]; my $return=h3("Revision: $revision<br />Checked in by: $author +<br />Checked in on: $date<br />"); $return.=b("Comment: ") . "<pre>"; for (my $i=3;$i<=$#entry;$i++) { $return.="$entry[$i]\n"; } $return.="</pre>\n"; return div({-class=>'entry'},$return); }
And the css...
body { background: white; font: normal 12px arial,sans; } form { margin-bottom:1px; } div.frm { background-color:#ccc; border:1px solid black; margin:5px 10%; padding:2px; text-align:right; } div.entry { background-color:#ccc; border:1px solid black; margin:5px 10%; padding:5px; } pre{ background-color:#fff;} h1{ text-align:center; font: bold 28px arial,sans; } h2{ text-align:center; font: bold 21px arial,sans; } h3 { background-color:#fff; font: bold 16px arial,sans; margin:0 0 0.4em 0; }

Replies are listed 'Best First'.
Re: subvert.pl: subversion log viewer
by ghenry (Vicar) on May 08, 2005 at 18:40 UTC

    Hi,

    I added:

    use CGI::Carp qw(fatalsToBrowser); # For better error messages

    I am not sure though, if the working directory, is a checked out one, or the base subversion one, as listed in the Apache config?

    Any tips?

    Gavin.

    Walking the road to enlightenment... I found a penguin and a camel on the way.....
    Fancy a yourname@perl.me.uk? Just ask!!!
      Cheers, Gavin, definitely a good idea.

      The working directory is the directory that's checked out. Also worth noting that you need to set permissions to your repository to allow apache write access which might not be ideal in a production environment ...
Re: subvert.pl: subversion log viewer
by thor (Priest) on May 09, 2005 at 14:26 UTC
    I knocked this up for home use.
    Getting frisky with the input ports on your PC, eh? :P

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come

      Getting frisky with the input ports on your PC, eh? :P

      And now I have to keep up with the maintenance ;-)
Re: subvert.pl: subversion log viewer
by dragonchild (Archbishop) on May 09, 2005 at 13:03 UTC
    Note: Using fatalsToBrowser is a very good development tool, it can provide entirely too much information to a malicious user if left on in production.

    • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
    • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"