=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 1.1.1.15 retrieving revision 3.36 diff -u -p -r1.1.1.15 -r3.36 --- cvsweb/cvsweb.cgi 2000/12/18 04:35:54 1.1.1.15 +++ cvsweb/cvsweb.cgi 2000/10/20 12:28:45 3.36 @@ -42,8 +42,8 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $zId: cvsweb.cgi,v 1.104 2000/11/01 22:05:12 hnordstrom Exp $ -# $kId: cvsweb.cgi,v 1.45 2000/12/18 04:25:30 knu Exp $ +# $zId: cvsweb.cgi,v 1.103 2000/09/20 17:02:29 jumager 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,11 +61,11 @@ 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 - $mimetype $charset $defaultTextPlain $defaultViewable - $allow_compress $GZIPBIN $backicon $diricon $fileicon - $fullname $newname $cvstreedefault - $body_tag $body_tag_for_src $logo $defaulttitle $address + $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 + $logo $defaulttitle $address $long_intro $short_instruction $shortLogLen $show_author $dirtable $tablepadding $columnHeaderColorDefault $columnHeaderColorSorted $hr_breakable $showfunc $hr_ignwhite @@ -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; @@ -244,7 +198,7 @@ $is_mod_perl = defined($ENV{MOD_PERL}); # in lynx, it it very annoying to have two links # per file, so disable the link at the icon # in this case: -$Browser = $ENV{HTTP_USER_AGENT} || ''; +$Browser = $ENV{HTTP_USER_AGENT}; $is_links = ($Browser =~ m`^Links `); $is_lynx = ($Browser =~ m`^Lynx/`i); $is_w3m = ($Browser =~ m`^w3m/`i); @@ -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 ""; @@ -909,13 +866,13 @@ elsif (-d $fullname) { my $fh = do {local(*FH);}; my ($xtra, $module); # Assume it's a module name with a potential path following it. - $xtra = (($module = $where) =~ s|/.*||) ? $& : ''; + $xtra = $& if (($module = $where) =~ s|/.*||); # Is there an indexed version of modules? if (open($fh, "$cvsroot/CVSROOT/modules")) { while (<$fh>) { if (/^(\S+)\s+(\S+)/o && $module eq $1 - && -d "$cvsroot/$2" && $module ne $2) { - &redirect("$scriptname/$2$xtra"); + && -d "${cvsroot}/$2" && $module ne $2) { + &redirect($scriptname . '/' . $2 . $xtra); } } } @@ -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); @@ -1001,13 +933,12 @@ sub findLastModifiedSubdirs(@) { sub htmlify_sub(&$) { (my $proc, local $_) = @_; local @_ = split(m`(]+>[^<]*)`i); - my $linked; - my $result = ''; + my ($linked, $result); while (($_, $linked) = splice(@_, 0, 2)) { &$proc(); - $result .= $_ if defined($_); - $result .= $linked if defined($linked); + $result .= $_; + $result .= $linked; } $result; @@ -1052,7 +983,7 @@ sub htmlify($;$) { \#?) (\d+)\b }{ - $1 . &link($2, sprintf($prcgi, $2)) + $1 . &link($2, sprintf($prcgi, $2)) . $3 }egix; } $_; } while ($_ ne $prev); @@ -1061,7 +992,7 @@ sub htmlify($;$) { s{ (\b$prcategories/(\d+)\b) }{ - &link($1, sprintf($prcgi, $2)) + &link($1, sprintf($prcgi, $2)) . $3 }egox; } $_; } @@ -1078,7 +1009,7 @@ sub htmlify($;$) { ) ) }{ - &link($1, sprintf($mancgi, $3 ne '' ? $3 : $4, $2)) + &link($1, sprintf($mancgi, $3 ne '' ? $3 : $4, $2)) . $5 }egx; } $_; } @@ -1489,11 +1420,6 @@ sub doCheckout($$) { open(STDERR, ">&STDOUT"); # Redirect stderr to stdout exec("cvs", "-Rld", $cvsroot, "co", "-p", $revopt, $where); } - - if (eof($fh)) { - &fatal("404 Not Found", - "$where is not (any longer) pertinent"); - } #=================================================================== #Checking out squid/src/ftp.c #RCS: /usr/src/CVS/squid/src/ftp.c,v @@ -1513,7 +1439,12 @@ sub doCheckout($$) { } if ($filename ne $where) { &fatal("500 Internal Error", - "Unexpected output from cvs co: $cvsheader"); + "Unexpected output from cvs co: $cvsheader" + . "Check whether the directory $cvsroot/CVSROOT exists " + . "and the script has write-access to the CVSROOT/history " + . "file if it exists." + . "The script needs to place lock files in the " + . "directory the file is in as well."); } $| = 1; @@ -1598,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; @@ -1632,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); @@ -1780,58 +1729,55 @@ sub getDirLogs($$@) { again: if ($state eq "head") { #$rcsfile = $1 if (/^RCS file: (.+)$/); #not used (yet) - - if (/^Working file: (.+)$/) { - $filename = $1; - } elsif (/^head: (.+)$/) { - $head = $1; - } elsif (/^branch: (.+)$/) { - $branch = $1 - } elsif (/^symbolic names:/) { - $state = "tags"; - ($branch = $head) =~ s/\.\d+$// if (!defined($branch)); - $branch =~ s/(\d+)$/0.$1/; - $symrev{MAIN} = $branch; - $symrev{HEAD} = $branch; - $alltags{MAIN} = 1; - $alltags{HEAD} = 1; - push (@filetags, "MAIN", "HEAD"); - } elsif (/$LOG_REVSEPARATOR/o) { - $state = "log"; - $rev = undef; - $date = undef; - $log = ""; - # Try to reconstruct the relative filename if RCS spits out a full path - $filename =~ s%^\Q$DirName\E/%%; - } + $filename = $1 if (/^Working file: (.+)$/); + $head = $1 if (/^head: (.+)$/); + $branch = $1 if (/^branch: (.+)$/); + } + if ($state eq "head" && /^symbolic names/) { + $state = "tags"; + ($branch = $head) =~ s/\.\d+$// if (!defined($branch)); + $branch =~ s/(\.?)(\d+)$/${1}0.$2/; + $symrev{MAIN} = $branch; + $symrev{HEAD} = $branch; + $alltags{MAIN} = 1; + $alltags{HEAD} = 1; + push (@filetags, "MAIN", "HEAD"); next; } - if ($state eq "tags") { - if (/^\s+(.+):\s+([\d\.]+)\s+$/) { - push (@filetags, $1); - $symrev{$1} = $2; - $alltags{$1} = 1; + if ($state eq "tags" && + /^\s+(.+):\s+([\d\.]+)\s+$/) { + push (@filetags, $1); + $symrev{$1} = $2; + $alltags{$1} = 1; + next; + } + if ($state eq "tags" && /^\S/) { + if (defined($tag) && (defined($symrev{$tag}) || $tag eq "HEAD")) { + $revwanted = $tag eq "HEAD" ? $symrev{"MAIN"} : $symrev{$tag}; + ($branch = $revwanted) =~ s/\b0\.//; + ($branchpoint = $branch) =~ s/\.?\d+$//; + $revwanted = undef if ($revwanted ne $branch); + } + elsif (defined($tag) && $tag ne "HEAD") { + print "Tag not found, skip this file" if ($verbose); + $state = "skip"; next; - } elsif (/^\S/) { - if (defined($tag)) { - if(defined($symrev{$tag}) || $tag eq "HEAD") { - $revwanted = $symrev{$tag eq "HEAD" ? "MAIN" : $tag}; - ($branch = $revwanted) =~ s/\b0\.//; - ($branchpoint = $branch) =~ s/\.?\d+$//; - $revwanted = undef if ($revwanted ne $branch); - } elsif ($tag ne "HEAD") { - print "Tag not found, skip this file" if ($verbose); - $state = "skip"; - next; - } - } - foreach my $tagfound (@filetags) { - $tags{$tagfound} = 1; - } - $state = "head"; - goto again; } + foreach my $tagfound (@filetags) { + $tags{$tagfound} = 1; + } + $state = "head"; + goto again; } + if ($state eq "head" && /$LOG_REVSEPARATOR/o) { + $state = "log"; + $rev = undef; + $date = undef; + $log = ""; + # Try to reconstruct the relative filename if RCS spits out a full path + $filename =~ s%^\Q$DirName\E/%%; + next; + } if ($state eq "log") { if (/$LOG_REVSEPARATOR/o || /$LOG_FILESEPARATOR/o) { # End of a log entry. @@ -2014,11 +1960,12 @@ sub readLog($;$) { # is the first commit listed on the appropriate branch. # This is not neccesary the same revision as marked as head in the RCS file. my $headrev = $curbranch || "1"; - ($symrev{"MAIN"} = $headrev) =~ s/(\d+)$/0.$1/; + ($symrev{"MAIN"} = $headrev) =~ s/(\.?)(\d+)$/${1}0.$2/; + revision: foreach $rev (@revorder) { if ($rev =~ /^(\S*)\.\d+$/ && $headrev eq $1) { $symrev{"HEAD"} = $rev; - last; + last revision; } } ($symrev{"HEAD"} = $headrev) =~ s/\.\d+$// @@ -2049,7 +1996,6 @@ sub readLog($;$) { # with the branch number 0.A, with the exception that # it has no head to translate to if there is nothing on # the branch, but I guess this can never happen? - # # (the code below gracefully forgets about the branch # if it should happen) # @@ -2057,13 +2003,14 @@ sub readLog($;$) { $branch = $3; $branchrev = $head . ($head ne "" ? "." : "") . $branch; my $regex; - $regex = quotemeta $branchrev; + ($regex = $branchrev) =~ s/\./\\./g; $rev = $head; + revision: foreach my $r (@revorder) { if ($r =~ /^${regex}\b/) { $rev = $branchrev; - last; + last revision; } } next if ($rev eq ""); @@ -2119,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) = @_; @@ -2257,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, @@ -2270,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, @@ -2303,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 @@ -2318,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"; @@ -2398,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) { @@ -2434,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 ""; @@ -2638,10 +2587,9 @@ sub navigateHeader($$$$$) { my ($swhere,$path,$filename,$rev,$title) = @_; $swhere = "" if ($swhere eq $scriptwhere); $swhere = urlencode($filename) if ($swhere eq ""); - print qq``; + print "<\!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"; print "\n\n"; - print qq`\n`; - print ''; + print ''; print "\n$path$filename - $title - $rev\n"; print "$body_tag_for_src\n"; print ""; @@ -3000,7 +2948,7 @@ sub http_header(;$) { } select(GZIP); $gzip_open = 1; -# print "" if ($content_type =~ m|^text/html\b|); +# print "" if ($content_type eq "text/html"); } else { if ($is_mod_perl) { @@ -3024,14 +2972,12 @@ sub http_header(;$) { sub html_header($) { my ($title) = @_; - my $version = '$zRevision: 1.104 $ $kRevision: 1.45 $'; #' - http_header(defined($charset) ? "text/html; charset=$charset" : "text/html"); + my $version = '$zRevision: 1.103 $ $Revision: 3.36 $'; #' + http_header(); print < - - $title
Check whether the directory $cvsroot/CVSROOT exists " + . "and the script has write-access to the CVSROOT/history " + . "file if it exists." + . "The script needs to place lock files in the " + . "directory the file is in as well."); } $| = 1; @@ -1598,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; @@ -1632,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); @@ -1780,58 +1729,55 @@ sub getDirLogs($$@) { again: if ($state eq "head") { #$rcsfile = $1 if (/^RCS file: (.+)$/); #not used (yet) - - if (/^Working file: (.+)$/) { - $filename = $1; - } elsif (/^head: (.+)$/) { - $head = $1; - } elsif (/^branch: (.+)$/) { - $branch = $1 - } elsif (/^symbolic names:/) { - $state = "tags"; - ($branch = $head) =~ s/\.\d+$// if (!defined($branch)); - $branch =~ s/(\d+)$/0.$1/; - $symrev{MAIN} = $branch; - $symrev{HEAD} = $branch; - $alltags{MAIN} = 1; - $alltags{HEAD} = 1; - push (@filetags, "MAIN", "HEAD"); - } elsif (/$LOG_REVSEPARATOR/o) { - $state = "log"; - $rev = undef; - $date = undef; - $log = ""; - # Try to reconstruct the relative filename if RCS spits out a full path - $filename =~ s%^\Q$DirName\E/%%; - } + $filename = $1 if (/^Working file: (.+)$/); + $head = $1 if (/^head: (.+)$/); + $branch = $1 if (/^branch: (.+)$/); + } + if ($state eq "head" && /^symbolic names/) { + $state = "tags"; + ($branch = $head) =~ s/\.\d+$// if (!defined($branch)); + $branch =~ s/(\.?)(\d+)$/${1}0.$2/; + $symrev{MAIN} = $branch; + $symrev{HEAD} = $branch; + $alltags{MAIN} = 1; + $alltags{HEAD} = 1; + push (@filetags, "MAIN", "HEAD"); next; } - if ($state eq "tags") { - if (/^\s+(.+):\s+([\d\.]+)\s+$/) { - push (@filetags, $1); - $symrev{$1} = $2; - $alltags{$1} = 1; + if ($state eq "tags" && + /^\s+(.+):\s+([\d\.]+)\s+$/) { + push (@filetags, $1); + $symrev{$1} = $2; + $alltags{$1} = 1; + next; + } + if ($state eq "tags" && /^\S/) { + if (defined($tag) && (defined($symrev{$tag}) || $tag eq "HEAD")) { + $revwanted = $tag eq "HEAD" ? $symrev{"MAIN"} : $symrev{$tag}; + ($branch = $revwanted) =~ s/\b0\.//; + ($branchpoint = $branch) =~ s/\.?\d+$//; + $revwanted = undef if ($revwanted ne $branch); + } + elsif (defined($tag) && $tag ne "HEAD") { + print "Tag not found, skip this file" if ($verbose); + $state = "skip"; next; - } elsif (/^\S/) { - if (defined($tag)) { - if(defined($symrev{$tag}) || $tag eq "HEAD") { - $revwanted = $symrev{$tag eq "HEAD" ? "MAIN" : $tag}; - ($branch = $revwanted) =~ s/\b0\.//; - ($branchpoint = $branch) =~ s/\.?\d+$//; - $revwanted = undef if ($revwanted ne $branch); - } elsif ($tag ne "HEAD") { - print "Tag not found, skip this file" if ($verbose); - $state = "skip"; - next; - } - } - foreach my $tagfound (@filetags) { - $tags{$tagfound} = 1; - } - $state = "head"; - goto again; } + foreach my $tagfound (@filetags) { + $tags{$tagfound} = 1; + } + $state = "head"; + goto again; } + if ($state eq "head" && /$LOG_REVSEPARATOR/o) { + $state = "log"; + $rev = undef; + $date = undef; + $log = ""; + # Try to reconstruct the relative filename if RCS spits out a full path + $filename =~ s%^\Q$DirName\E/%%; + next; + } if ($state eq "log") { if (/$LOG_REVSEPARATOR/o || /$LOG_FILESEPARATOR/o) { # End of a log entry. @@ -2014,11 +1960,12 @@ sub readLog($;$) { # is the first commit listed on the appropriate branch. # This is not neccesary the same revision as marked as head in the RCS file. my $headrev = $curbranch || "1"; - ($symrev{"MAIN"} = $headrev) =~ s/(\d+)$/0.$1/; + ($symrev{"MAIN"} = $headrev) =~ s/(\.?)(\d+)$/${1}0.$2/; + revision: foreach $rev (@revorder) { if ($rev =~ /^(\S*)\.\d+$/ && $headrev eq $1) { $symrev{"HEAD"} = $rev; - last; + last revision; } } ($symrev{"HEAD"} = $headrev) =~ s/\.\d+$// @@ -2049,7 +1996,6 @@ sub readLog($;$) { # with the branch number 0.A, with the exception that # it has no head to translate to if there is nothing on # the branch, but I guess this can never happen? - # # (the code below gracefully forgets about the branch # if it should happen) # @@ -2057,13 +2003,14 @@ sub readLog($;$) { $branch = $3; $branchrev = $head . ($head ne "" ? "." : "") . $branch; my $regex; - $regex = quotemeta $branchrev; + ($regex = $branchrev) =~ s/\./\\./g; $rev = $head; + revision: foreach my $r (@revorder) { if ($r =~ /^${regex}\b/) { $rev = $branchrev; - last; + last revision; } } next if ($rev eq ""); @@ -2119,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) = @_; @@ -2257,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, @@ -2270,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, @@ -2303,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 @@ -2318,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"; @@ -2398,8 +2343,8 @@ sub doLog($) { print "\n"; print "