And the css...#!/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.=" to revision: "; $return.=textfield({-name=>"end"},"$end"); $return.=" " . 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); }
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 | |
by ciderpunx (Vicar) on May 08, 2005 at 22:22 UTC | |
|
Re: subvert.pl: subversion log viewer
by thor (Priest) on May 09, 2005 at 14:26 UTC | |
by ciderpunx (Vicar) on May 10, 2005 at 10:22 UTC | |
|
Re: subvert.pl: subversion log viewer
by dragonchild (Archbishop) on May 09, 2005 at 13:03 UTC |