|
|
| |
} | } |
| |
sub showdiff { | sub showdiff { |
my $args = shift; | my $args = shift; |
my $fh = do {local(*FH);}; | my $fh = do {local(*FH);}; |
my $title = $args->{file}; | my $title = $args->{file}; |
print <<EOM; | print <<EOM; |
Content-Type: text/html\r\n\r | Content-Type: text/html\r\n\r |
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" | <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" |
"http://www.w3.org/TR/REC-html40/loose.dtd"> | "http://www.w3.org/TR/REC-html40/loose.dtd"> |
<html> | <html> |
<title>$title</title> | <title>$title</title> |
<!-- hennerik CVSweb $version --> | <!-- hennerik CVSweb $version --> |
</head> | </head> |
<body text="#000000" bgcolor="#ffffff"> | <body text="#000000" bgcolor="#ffffff"> |
| added one line |
EOM | EOM |
my $rev2 = "1bdafs"; | my $rev2 = "1bdafs"; |
if (!open($fh, "-|")) { #child | if (!open($fh, "-|")) { #child |
if ($input{f} ne "h") { | if ($input{f} ne "h") { |
# -w ignore white | # -w ignore white |
exec("diff", "-u", "-w", "--unified=15", $args->{file}, $args->{file2}); | exec("diff", "-u", "-w", "--unified=15", $args->{file}, $args->{file2}); |
} else { | } else { |
exec("diff", "-u", "-w", $args->{file}, $args->{file2}); | exec("diff", "-u", "-w", $args->{file}, $args->{file2}); |
} | } |
} | } |
&human_readable_diff($fh, $rev2); | &human_readable_diff($fh, $rev2); |
close($fh); | close($fh); |
| |
print <<EOM; | print <<EOM; |
</table></body></html> | </table></html> |
EOM | EOM |
| |
} | } |
| |
sub flush_diff_rows ($$$$) | sub flush_diff_rows ($$$$) |
{ | { |
my $fs = "<font face=\"$difffontface\" size=\"$difffontsize\">"; | my $fs = "<font face=\"$difffontface\" size=\"$difffontsize\">"; |
my $fe = "</font>"; | my $fe = "</font>"; |
| |
my $j; | my $j; |
my ($leftColRef,$rightColRef,$leftRow,$rightRow) = @_; | my ($leftColRef,$rightColRef,$leftRow,$rightRow) = @_; |
if ($state eq "PreChangeRemove") { # we just got remove-lines before | if ($state eq "PreChangeRemove") { # we just got remove-lines before |
for ($j = 0 ; $j < $leftRow; $j++) { | for ($j = 0 ; $j < $leftRow; $j++) { |
print "<tr><td bgcolor=\"$diffcolorRemove\">$fs ".spacedHtmlText(@$leftColRef[$j]) . "$fe</td>"; | print "<tr><td bgcolor=\"$diffcolorRemove\">$fs ".spacedHtmlText(@$leftColRef[$j]) . "$fe</td>"; |
print "<td bgcolor=\"$diffcolorEmpty\"> </td></tr>\n"; | print "<td bgcolor=\"$diffcolorEmpty\">added some text </td></tr>\n"; |
} | } |
} | } |
elsif ($state eq "PreChange") { # state eq "PreChange" | elsif ($state eq "PreChange") { # state eq "PreChange" |
if ($has_ediff) { | if ($has_ediff) { |
# construct the suffix tree | # construct the suffix tree |
my $left_diff = join "\n", @$leftColRef[0..$leftRow-1]; | my $left_diff = join "\n", @$leftColRef[0..$leftRow-1]; |
my $right_diff = join "\n", @$rightColRef[0..$rightRow-1]; | my $right_diff = join "\n", @$rightColRef[0..$rightRow-1]; |
my $diff_str = String::Ediff::ediff($left_diff, $right_diff); | my $diff_str = String::Ediff::ediff($left_diff, $right_diff); |
# print "------------------------------\n\n\n", $diff_str, | # print "------------------------------\n\n\n", $diff_str, |
# "------------------------------\n\n\n",; | # "------------------------------\n\n\n",; |
my @diff_str = split / /, $diff_str; | my @diff_str = split / /, $diff_str; |
my $INFINITY = 10000000; | my $INFINITY = 10000000; |
push @diff_str, ($INFINITY, $INFINITY, $INFINITY, $INFINITY, $INFINITY, $INFINITY, $INFINITY, $INFINITY); | push @diff_str, ($INFINITY, $INFINITY, $INFINITY, $INFINITY, $INFINITY, $INFINITY, $INFINITY, $INFINITY); |
my ($idx, $b1, $e1, $lb1, $le1, $b2, $e2, $lb2, $le2) = (0, @diff_str[0..7]); | my ($idx, $b1, $e1, $lb1, $le1, $b2, $e2, $lb2, $le2) = (0, @diff_str[0..7]); |
my ($l_cul, $r_cul) = (0,0); | my ($l_cul, $r_cul) = (0,0); |