=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 1.1.1.13 retrieving revision 3.37 diff -u -p -r1.1.1.13 -r3.37 --- cvsweb/cvsweb.cgi 2000/12/07 12:45:50 1.1.1.13 +++ cvsweb/cvsweb.cgi 2000/10/20 15:46:01 3.37 @@ -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.41 2000/12/06 18:19:12 knu Exp $ +# $zId: cvsweb.cgi,v 1.103 2000/09/20 17:02:29 jumager Exp $ +# $Id: cvsweb.cgi,v 3.37 2000/10/20 15:46:01 knu Exp $ # ### @@ -63,10 +63,10 @@ use vars qw ( $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 + $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 @@ -1001,13 +1001,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; @@ -1489,11 +1488,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 +1507,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; @@ -1780,59 +1779,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+)$/${1}0.$2/; - $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/\.0\././; - ($branchpoint = $branch) =~ s/\.?\d+$//; - $revwanted = undef if ($revwanted ne $branch); -#print "\n[revwanted=$revwanted]"; - } 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. @@ -2016,10 +2011,11 @@ sub readLog($;$) { # This is not neccesary the same revision as marked as head in the RCS file. my $headrev = $curbranch || "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+$// @@ -2037,7 +2033,7 @@ sub readLog($;$) { foreach (reverse sort keys %symrev) { $rev = $symrev{$_}; - if ($rev =~ /^((.*)\.)0\.(\d+)$/) { + if ($rev =~ /^((.*)\.)?\b0\.(\d+)$/) { push(@branchnames, $_); # # A revision number of A.B.0.D really translates into @@ -2050,22 +2046,21 @@ 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) # - # Since some stupid people actually import/check in - # files with version 0.X we assume that the above cannot - # happen, and regard 0.X(.*) as a revision and not a branch. - # $head = defined($2) ? $2 : ""; $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 ""); @@ -2083,7 +2078,7 @@ sub readLog($;$) { my ($onlyonbranch, $onlybranchpoint); if ($onlyonbranch = $input{'only_with_tag'}) { $onlyonbranch = $symrev{$onlyonbranch}; - if ($onlyonbranch =~ s/\.0\././) { + if ($onlyonbranch =~ s/\b0\.//) { ($onlybranchpoint = $onlyonbranch) =~ s/\.\d+$//; } else { @@ -2642,7 +2637,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 ""; @@ -2845,7 +2840,7 @@ sub fileSortCmp() { sub download_url($$;$) { my ($url,$revision,$mimetype) = @_; - $revision =~ s/\.0\././; + $revision =~ s/\b0\.//; if (defined($checkoutMagic) && (!defined($mimetype) || $mimetype ne "text/x-cvsweb-markup")) { @@ -3001,7 +2996,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) { @@ -3025,13 +3020,12 @@ sub http_header(;$) { sub html_header($) { my ($title) = @_; - my $version = '$zRevision: 1.104 $ $kRevision: 1.41 $'; #' - http_header($charset ne "" ? "text/html; charset=$charset" : "text/html"); + my $version = '$zRevision: 1.103 $ $Revision: 3.37 $'; #' + http_header(); print < - $title