webrev revision 8453
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Script for generating code review pages similar to those generated by
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# ON's webrev tool
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# CDDL HEADER START
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# The contents of this file are subject to the terms of the
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Common Development and Distribution License, Version 1.0 only
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# (the "License"). You may not use this file except in compliance
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# with the License.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c9f77c52c0735e65aa2534394c5151cdb963cbefAndy Stormont# See the License for the specific language governing permissions
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# and limitations under the License.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# When distributing Covered Code, include this CDDL HEADER in each
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov# If applicable, add the following below this CDDL HEADER, with the
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# fields enclosed by brackets "[]" replaced with your own identifying
c9f77c52c0735e65aa2534394c5151cdb963cbefAndy Stormont# information: Portions Copyright [yyyy] [name of copyright owner]
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# CDDL HEADER END
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe# Use is subject to license terms.
use strict;
use Fcntl;
# HTML page header template for index.html
my $index_page_header =
# HTML page footer template for index.html
my $index_page_footer =
my %file_status;
my %file_prop;
my $scm;
my %file_hist;
my $msg = shift;
my $msg = shift;
my $msg = shift;
$file_status{$7} = $1;
$file_prop{$7} = $2;
$file_hist{$7} = $4;
my @lines = `LC_ALL=C cvs -z3 status 2>&1 | egrep '(^\\? |^cvs status: Examining |Status:)' | grep -v Up-to-date`
my $f0 = $1;
my $uname;
my $author;
my $hostname;
my $str = shift;
my $title = shift;
$str =~ s/\\n/\n/g;
return $str;
my $str = shift;
$str =~ s/\t/ /g;
return $str;
my $webrev_dir = shift;
my $file = shift;
my $webrev_dir = shift;
my $file = shift;
my $webrev_dir = shift;
my $file = shift;
return undef;
return undef;
return undef;
system ("cd $webrev_dir/tmp && LC_ALL=C cvs -q -z3 -d $CVSROOT co -r$rev $REPO/$basename >/dev/null 2>&1 && mv $REPO/$basename $webrev_dir/$file/old.$basename && cd / && rm -rf $webrev_dir/tmp");
return undef;
my $webrev_dir = shift;
my $file = shift;
my @diff;
return undef;
my $webrev_dir = shift;
my $file = shift;
return undef;
my $ref = shift;
my $start = shift;
my $line = shift;
my $end = shift;
my $indent_len = shift;
my $ref = shift;
my $len = shift;
$len--;
my $ref = shift;
my $len = shift;
$len--;
my $webrev_dir = shift;
my $file = shift;
$total_lines++;
my $left_line;
my $right_line;
my @dellines;
my $line1 = $1;
$n1--;
$n2--;
$n1 = 0;
$n2 = 0;
return undef;
my $col = 1;
$col = 1;
my $webrev_dir = shift;
my $file = shift;
system ("rm -f $webrev_dir/$file/$basename.diff; svn --non-interactive diff $file > $webrev_dir/$file/$basename.diff");
system ("rm -f $webrev_dir/$file/$basename.diff; cvs -q diff -up $file > $webrev_dir/$file/$basename.diff");
return undef;
my %changelog_entry;
my @chlog_lines;
my $entry = $1;
my $ecat = $1;
$ecat =~ s/^\s*\*\s*//;
$ecat = $2;
my $webrev_dir = shift;
my $total_new = 0;
my $total_deleted = 0;
my $total_changed = 0;
my $total_unchanged = 0;
my $total_non_svn = 0;
$total_new += $lines;
$total_deleted += $lines;
$total_non_svn += $lines;
my $label;
my $changed_lines = `diff -c $webrev_dir/$file/old.$basename $webrev_dir/$file/new.$basename | grep '^! ' | wc -l`;
my $deleted_lines = `diff -c $webrev_dir/$file/old.$basename $webrev_dir/$file/new.$basename | grep '^- ' | wc -l`;
my $new_lines = `diff -c $webrev_dir/$file/old.$basename $webrev_dir/$file/new.$basename | grep '^+ ' | wc -l`;
print INDEX "$new_lines line(s) new / $deleted_lines line(s) deleted / $changed_lines line(s) updated / $unchanged_lines line(s) unchanged\n";
$total_new += $new_lines;
print INDEX $changelog_entry{$file};
print INDEX "<P><B>Total</B>: $total_new line(s) new / $total_deleted line(s) deleted / $total_changed line(s) updated / $total_unchanged line(s) unchanged<BR>\n";