=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 1.1.1.11 retrieving revision 3.36 diff -u -p -r1.1.1.11 -r3.36 --- cvsweb/cvsweb.cgi 2000/10/20 15:54:58 1.1.1.11 +++ cvsweb/cvsweb.cgi 2000/10/20 12:28:45 3.36 @@ -43,7 +43,7 @@ # SUCH DAMAGE. # # $zId: cvsweb.cgi,v 1.103 2000/09/20 17:02:29 jumager Exp $ -# $kId: cvsweb.cgi,v 1.37 2000/10/20 15:46:01 knu Exp $ +# $Id: cvsweb.cgi,v 3.36 2000/10/20 12:28:45 knu Exp $ # ### @@ -52,7 +52,6 @@ use strict; use vars qw ( $config $allow_version_select $verbose %CVSROOT %CVSROOTdescr %MIRRORS %DEFAULTVALUE %ICONS %MTYPES - @DIFFTYPES %DIFFTYPES @LOGSORTKEYS %LOGSORTKEYS %alltags @tabcolors %fileinfo %tags @branchnames %nameprinted %symrev %revsym @allrevisions %date %author @revdisplayorder @revisions %state %difflines %log %branchpoint @revorder @@ -62,7 +61,7 @@ use vars qw ( %funcline_regexp $is_mod_perl $is_links $is_lynx $is_w3m $is_msie $is_mozilla3 $is_textbased %input $query $barequery $sortby $bydate $byrev $byauthor - $bylog $byfile $defaultDiffType $logsort $cvstree $cvsroot + $bylog $byfile $hr_default $logsort $cvstree $cvsroot $mimetype $defaultTextPlain $defaultViewable $allow_compress $GZIPBIN $backicon $diricon $fileicon $fullname $newname $cvstreedefault $body_tag $body_tag_for_src @@ -84,8 +83,6 @@ use vars qw ( ); sub printDiffSelect($); -sub printDiffLinks($$); -sub printLogSortSelect($); sub findLastModifiedSubdirs(@); sub htmlify_sub(&$); sub htmlify($;$); @@ -169,49 +166,6 @@ $tabstop = $use_moddate = $moddate = $gzip_open = unde $LOG_FILESEPARATOR = q/^={77}$/; $LOG_REVSEPARATOR = q/^-{28}$/; -@DIFFTYPES = qw(h H u c s); -@DIFFTYPES{@DIFFTYPES} = ( - { - 'descr' => 'colored', - 'opts' => [ '-u' ], - 'colored' => 1, - }, - { - 'descr' => 'long colored', - 'opts' => [ '--unified=15' ], - 'colored' => 1, - }, - { - 'descr' => 'unified', - 'opts' => [ '-u' ], - 'colored' => 0, - }, - { - 'descr' => 'context', - 'opts' => [ '-c' ], - 'colored' => 0, - }, - { - 'descr' => 'side by side', - 'opts' => [ '--side-by-side', '--width=164' ], - 'colored' => 0, - }, - ); - -@LOGSORTKEYS = qw(cvs date rev); -@LOGSORTKEYS{@LOGSORTKEYS} = ( - { - 'descr' => 'Not sorted', - }, - { - 'descr' => 'Commit date', - }, - { - 'descr' => 'Revision', - }, - ); - - ##### End of configuration variables ##### use Time::Local; @@ -375,7 +329,7 @@ else { $byfile = 1; } -$defaultDiffType = $input{'f'}; +$hr_default = ($input{'f'} eq 'h' || $input{'f'} eq 'H'); $logsort = $input{'logsort'}; @@ -831,9 +785,12 @@ elsif (-d $fullname) { print "Revision"; print "Log message"; print ""; - print "Sort log by: "; - printLogSortSelect(0); - print ""; + print "revisions by: \n"; + print "\n"; + print "Not sorted"; + print "Commit date"; + print "Revision"; + print ""; print "Diff format: "; printDiffSelect(0); print ""; @@ -927,43 +884,18 @@ gzipclose(); sub printDiffSelect($) { my ($use_java_script) = @_; - my $f = $input{'f'}; - - print ''; - - local $_; - for (@DIFFTYPES) { - printf('%s', - $_, - $f eq $_ ? ' SELECTED' : '', - "\u$DIFFTYPES{$_}{'descr'}" - ); - } - + my ($f) = $input{'f'}; + print "\n"; + print "Colored Diff"; + print "Long Colored Diff"; + print "Unidiff"; + print "Context Diff"; + print "Side by Side"; print ""; } -sub printLogSortSelect($) { - my ($use_java_script) = @_; - - print ''; - - local $_; - for (@LOGSORTKEYS) { - printf('%s', - $_, - $logsort eq $_ ? ' SELECTED' : '', - "\u$LOGSORTKEYS{$_}{'descr'}" - ); - } - - print ""; -} - sub findLastModifiedSubdirs(@) { my (@dirs) = @_; my ($dirname, @files); @@ -1597,7 +1529,7 @@ sub viewable($) { sub doDiff($$$$$$) { my($fullname, $r1, $tr1, $r2, $tr2, $f) = @_; my $fh = do {local(*FH);}; - my ($rev1, $rev2, $sym1, $sym2, $f1, $f2); + my ($rev1, $rev2, $sym1, $sym2, @difftype, $diffname, $f1, $f2); if ($r1 =~ /([^:]+)(:(.+))?/) { $rev1 = $1; @@ -1631,18 +1563,36 @@ sub doDiff($$$$$$) { ($rev1, $sym1) = ($rev2, $sym2); ($rev2, $sym2) = ($tmp1, $tmp2); } - my $difftype = $DIFFTYPES{$f}; - - if (!$difftype) { + my $human_readable = 0; + if ($f eq 'c') { + @difftype = qw{-c}; + $diffname = "Context diff"; + } + elsif ($f eq 's') { + @difftype = qw{--side-by-side --width=164}; + $diffname = "Side by Side"; + } + elsif ($f eq 'H') { + $human_readable = 1; + @difftype = qw{--unified=15}; + $diffname = "Long Human readable"; + } + elsif ($f eq 'h') { + @difftype =qw{-u}; + $human_readable = 1; + $diffname = "Human readable"; + } + elsif ($f eq 'u') { + @difftype = qw{-u}; + $diffname = "Unidiff"; + } + else { fatal ("400 Bad arguments", "Diff format $f not understood"); } - my @difftype = @{$difftype->{'opts'}}; - my $human_readable = $difftype->{'colored'}; - # apply special options if ($showfunc) { - push @difftype, '-p' if $f ne 's'; + push @difftype, '-p' if $f =~ /^[cHhu]$/; my($re1, $re2); @@ -2116,20 +2066,6 @@ sub readLog($;$) { } -sub printDiffLinks($$) { - my($text, $url) = @_; - my @extra; - - local $_; - for ($DIFFTYPES{$defaultDiffType}{'colored'} ? qw(u) : qw(h)) { - my $f = $_ eq $defaultDiffType ? '' : $_; - - push @extra, &link(lc $DIFFTYPES{$_}{'descr'}, "$url&f=$f"); - } - - print &link($text, $url), ' (', join(', ', @extra), ')'; -} - sub printLog($;$) { my ($link, $br, $brp); ($_,$link) = @_; @@ -2254,7 +2190,10 @@ sub printLog($;$) { $barequery); print " to previous "; - printDiffLinks($prev, $url); + print &link($prev, $url); + if (!$hr_default) { # offer a human readable version if not default + print ' (', &link('colored', "$url&f=h"), ')'; + } } # # Plus, if it's on a branch, and it's not a vendor branch, @@ -2267,7 +2206,10 @@ sub printLog($;$) { $barequery); print " to branchpoint "; - printDiffLinks($brp, $url); + print &link($brp, $url); + if (!$hr_default) { # offer a human readable version if not default + print ' (', &link('colored', "$url&f=h"), ')'; + } } # # Plus, if it's on a branch, and it's not a vendor branch, @@ -2300,7 +2242,10 @@ sub printLog($;$) { $barequery); print " next main "; - printDiffLinks($nextmain, $url); + print &link($nextmain, $url); + if (!$hr_default) { # offer a human readable version if not default + print ' (', &link('colored', "$url&f=h"), ')'; + } } } # Plus if user has selected only r1, then present a link @@ -2315,7 +2260,10 @@ sub printLog($;$) { $barequery); print " to selected "; - printDiffLinks($input{'r1'}, $url); + print &link($input{'r1'}, $url); + if (!$hr_default) { # offer a human readable version if not default + print ' (', &link('colored', "$url&f=h"), ')'; + } } } print "\n"; @@ -2395,8 +2343,8 @@ sub doLog($) { print "\n"; print ""; print "\n"; - print "Preferred Diff type:"; - print ""; + print "Preferred Diff type:"; + print ""; printDiffSelect($use_java_script); print "\n"; if (@branchnames) { @@ -2431,9 +2379,13 @@ sub doLog($) { print ""; print "\n"; print "Sort log by:"; - print ""; - printLogSortSelect($use_java_script); - print ""; + print "\n"; + print "Not sorted"; + print "Commit date"; + print "Revision"; + print ""; print ""; print "\n"; print ""; @@ -2637,7 +2589,7 @@ sub navigateHeader($$$$$) { $swhere = urlencode($filename) if ($swhere eq ""); print "<\!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"; print "\n\n"; - print ''; + print ''; print "\n$path$filename - $title - $rev\n"; print "$body_tag_for_src\n"; print ""; @@ -3020,7 +2972,7 @@ sub http_header(;$) { sub html_header($) { my ($title) = @_; - my $version = '$zRevision: 1.103 $ $kRevision: 1.37 $'; #' + my $version = '$zRevision: 1.103 $ $Revision: 3.36 $'; #' http_header(); print <
\n"; @@ -2395,8 +2343,8 @@ sub doLog($) { print "\n"; print "