diff --git a/data/cgi/cvsweb.cgi b/data/cgi/cvsweb.cgi index 9ad2f87a23..ac67257c71 100755 --- a/data/cgi/cvsweb.cgi +++ b/data/cgi/cvsweb.cgi @@ -76,7 +76,6 @@ $scriptname =~ s|/$||; $scriptwhere = $scriptname . '/' . $where; $scriptwhere =~ s|/$||; - if ($query = $ENV{'QUERY_STRING'}) { foreach (split(/&/, $query)) { s/%(..)/sprintf("%c", hex($1))/ge; # unquote %-quoted @@ -102,8 +101,9 @@ if ($input{'cvsroot'}) { do "$config-$cvstree" if -f "$config-$cvstree"; $fullname = $cvsroot . '/' . $where; + if (!-d $cvsroot) { - &fatal("500 Internal Error",'$CVSROOT not found!'); + &fatal("500 Internal Error",'$CVSROOT not found!

The server on which the CVS tree lives is probably down. Please try again in a few minutes.'); } @@ -130,6 +130,7 @@ if (-d $fullname) { last lookingforattic; } } + $haveattic = 1 if ($i <= $#dir); if (!$input{"showattic"} && ($i <= $#dir) && opendir(DIR, $fullname . "/Attic")) { splice(@dir, $i, 1, @@ -155,13 +156,14 @@ if (-d $fullname) { # &link("Directory-wide diffs", $scriptwhere . '/*'), "
"; } elsif (-d $fullname . "/" . $_) { print " ", - &link($_ . "/", $scriptwhere . '/' . $_ . '/' . $query), $attic, "
"; + &link($_ . "/", $scriptwhere . '/' . $_ . '/' . $query), + $attic, "
"; } elsif (s/,v$//) { # TODO: add date/time? How about sorting? print " ", &link($_, $scriptwhere . '/' . ($attic ? "Attic/" : "") . $_ . $query), - $attic, "
"; + $attic, "
"; } } print "\n"; @@ -177,15 +179,17 @@ if (-d $fullname) { } $formwhere = $scriptwhere; $formwhere =~ s|Attic/?$|| if ($input{"showattic"}); - print "


\n"; - $input{"showattic"}=!$input{"showattic"}; - foreach $k (keys %input) { - print "\n" if $input{$k}; + if ($haveattic) { + print "
\n"; + $input{"showattic"}=!$input{"showattic"}; + foreach $k (keys %input) { + print "\n" if $input{$k}; + } + print "\n"; + print "
\n"; } - print "\n"; - print "\n"; print &html_footer; print "\n"; } elsif (-f $fullname . ',v') { @@ -198,297 +202,8 @@ if (-d $fullname) { $input{'r2'}, $input{'tr2'}, $input{'f'}); exit; } - open(RCS, "rlog '$fullname'|") || &fatal("500 Internal Error", - "Failed to spawn rlog"); - while () { - print if ($verbose); - if (/^branch:\s+([\d\.]+)/) { - $curbranch = $1; - } - if ($symnames) { - if (/^\s+([^:]+):\s+([\d\.]+)/) { - $symrev{$1} = $2; - if ($revsym{$2}) { - $revsym{$2} .= ", "; - } - $revsym{$2} .= $1; - } else { - $symnames = 0; - } - } elsif (/^symbolic names/) { - $symnames = 1; - } elsif (/^-----/) { - last; - } - } - - if ($onlyonbranch = $input{'only_on_branch'}) { - ($onlyonbranch = $symrev{$onlyonbranch}) =~ s/\.0\././; - ($onlybranchpoint = $onlyonbranch) =~ s/\.\d+$//; - } - -# each log entry is of the form: -# ---------------------------- -# revision 3.7.1.1 -# date: 1995/11/29 22:15:52; author: fenner; state: Exp; lines: +5 -3 -# log info -# ---------------------------- - logentry: - while (!/^=========/) { - $_ = ; - print "R:", $_ if ($verbose); - if (/^revision ([\d\.]+)/) { - $rev = $1; - } elsif (/^========/ || /^----------------------------$/) { - next logentry; - } else { - &fatal("500 Internal Error","Error parsing RCS output: $_"); - } - $_ = ; - print "D:", $_ if ($verbose); - if (m|^date:\s+(\d+)/(\d+)/(\d+)\s+(\d+):(\d+):(\d+);\s+author:\s+(\S+);\s+state:\s+(\S+);|) { - $yr = $1; - # damn 2-digit year routines - if ($yr > 100) { - $yr -= 1900; - } - $date{$rev} = &timelocal($6,$5,$4,$3,$2 - 1,$yr); - $author{$rev} = $7; - $state{$rev} = $8; - } else { - &fatal("500 Internal Error", "Error parsing RCS output: $_"); - } - line: - while () { - print "L:", $_ if ($verbose); - next line if (/^branches:\s/); - last line if (/^----------------------------$/ || /^=========/); - $log{$rev} .= $_; - } - print "E:", $_ if ($verbose); - } - close(RCS); - print "Done reading RCS file\n" if ($verbose); -# -# Sort the revisions into commit-date order. - @revorder = sort {$date{$b} <=> $date{$a}} keys %date; - print "Done sorting revisions\n" if ($verbose); -# -# HEAD is an artificial tag which is simply the highest tag number on the main -# branch, unless there is a branch tag in the RCS file in which case it's the -# highest revision on that branch. Find it by looking through @revorder; it -# is the first commit listed on the appropriate branch. - $headrev = $curbranch || "1"; - revision: - for ($i = 0; $i <= $#revorder; $i++) { - if ($revorder[$i] =~ /^(\S*)\.\d+$/ && $headrev eq $1) { - if ($revsym{$revorder[$i]}) { - $revsym{$revorder[$i]} .= ", "; - } - $revsym{$revorder[$i]} .= "HEAD"; - $symrev{"HEAD"} = $revorder[$i]; - last revision; - } - } - print "Done finding HEAD\n" if ($verbose); -# -# Now that we know all of the revision numbers, we can associate -# absolute revision numbers with all of the symbolic names, and -# pass them to the form so that the same association doesn't have -# to be built then. -# -# should make this a case-insensitive sort - foreach (sort keys %symrev) { - $rev = $symrev{$_}; - if ($rev =~ /^(\d+(\.\d+)+)\.0\.(\d+)$/) { - push(@branchnames, $_); - # - # A revision number of A.B.0.D really translates into - # "the highest current revision on branch A.B.D". - # - # If there is no branch A.B.D, then it translates into - # the head A.B . - # - $head = $1; - $branch = $3; - $regex = $head . "." . $branch; - $regex =~ s/\./\./g; - # < - # \____/ - $rev = $head; - - revision: - foreach $r (@revorder) { - if ($r =~ /^${regex}/) { - $rev = $head . "." . $branch; - last revision; - } - } - $revsym{$rev} .= ", " if ($revsym{$rev}); - $revsym{$rev} .= $_; - if ($rev ne $head) { - $branchpoint{$head} .= ", " if ($branchpoint{$head}); - $branchpoint{$head} .= $_; - } - } - $sel .= "