=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 1.7 retrieving revision 1.10 diff -u -p -r1.7 -r1.10 --- cvsweb/cvsweb.cgi 1997/04/30 18:25:05 1.7 +++ cvsweb/cvsweb.cgi 1997/11/14 17:36:47 1.10 @@ -31,7 +31,17 @@ require 'ctime.pl'; $hsty_base = ""; require 'cgi-style.pl'; -$cvsroot = '/home/ncvs'; +%CVSROOT = ( + 'freebsd', '/home/ncvs', + 'openbsd', '/home/OpenBSD/cvs', + 'learn', '/c/learncvs', + ); + +$cvstreedefault = 'freebsd'; +$cvstree = $cvstreedefault; +$cvsroot = $CVSROOT{"$cvstree"} || "/home/ncvs"; + + $intro = " This is a WWW interface to the FreeBSD CVS tree. You can browse the file hierarchy by picking directories @@ -49,7 +59,7 @@ CVS tree, see .

Please send any suggestions, comments, etc. to -Bill Fenner <fenner@freebsd.org> +Bill Fenner <fenner\@freebsd.org> "; $shortinstr = " Click on a directory to enter that directory. Click on a file to display @@ -60,18 +70,14 @@ chance to display diffs between revisions. $verbose = $v; ($where = $ENV{'PATH_INFO'}) =~ s|^/||; $where =~ s|/$||; -$fullname = $cvsroot . '/' . $where; ($scriptname = $ENV{'SCRIPT_NAME'}) =~ s|^/?|/|; $scriptname =~ s|/$||; $scriptwhere = $scriptname . '/' . $where; $scriptwhere =~ s|/$||; -if (!-d $cvsroot) { - &fatal("500 Internal Error",'$CVSROOT not found!'); -} -if ($q = $ENV{'QUERY_STRING'}) { - foreach (split(/&/, $q)) { +if ($query = $ENV{'QUERY_STRING'}) { + foreach (split(/&/, $query)) { s/%(..)/sprintf("%c", hex($1))/ge; # unquote %-quoted if (/(\S+)=(.*)/) { $input{$1} = $2; @@ -79,7 +85,24 @@ if ($q = $ENV{'QUERY_STRING'}) { $input{$_}++; } } + $query = "?" . $query; } + + + +if ($input{'cvsroot'}) { + if ($CVSROOT{$input{'cvsroot'}}) { + $cvstree = $input{'cvsroot'}; + $cvsroot = $CVSROOT{"$cvstree"}; + } +} + +$fullname = $cvsroot . '/' . $where; +if (!-d $cvsroot) { + &fatal("500 Internal Error",'$CVSROOT not found!'); +} + + if (-d $fullname) { opendir(DIR, $fullname) || &fatal("404 Not Found","$where: $!"); @dir = readdir(DIR); @@ -97,27 +120,68 @@ if (-d $fullname) { # provides the results that I want in most browsers. Another # case of layout spooging up HTML. print "

\n"; - foreach (sort @dir) { + lookingforattic: + for ($i = 0; $i <= $#dir; $i++) { + if ($dir[$i] eq "Attic") { + last lookingforattic; + } + } + if (!$input{"showattic"} && ($i <= $#dir) && + opendir(DIR, $fullname . "/Attic")) { + splice(@dir, $i, 1, + grep((s|^|Attic/|,!m|/\.|), readdir(DIR))); + closedir(DIR); + } + # Sort without the Attic/ pathname. + foreach (sort {($c=$a)=~s|.*/||;($d=$b)=~s|.*/||;($c cmp $d)} @dir) { if ($_ eq '.') { next; } + if (s|^Attic/||) { + $attic = " (in the Attic)"; + } else { + $attic = ""; + } if ($_ eq '..') { next if ($where eq ''); ($updir = $scriptwhere) =~ s|[^/]+$||; print " ", - &link("Previous Directory",$updir), "
"; + &link("Previous Directory",$updir . $query), "
"; # print " ", # &link("Directory-wide diffs", $scriptwhere . '/*'), "
"; } elsif (-d $fullname . "/" . $_) { print " ", - &link($_ . "/", $scriptwhere . '/' . $_ . '/'), "
"; + &link($_ . "/", $scriptwhere . '/' . $_ . '/' . $query), $attic, "
"; } elsif (s/,v$//) { # TODO: add date/time? How about sorting? print " ", - &link($_, $scriptwhere . '/' . $_), "
"; + &link($_, $scriptwhere . '/' . + ($attic ? "Attic/" : "") . $_ . $query), + $attic, "
"; } } print "
\n"; + if ($input{"only_on_branch"}) { + print "
\n"; + print "Currently showing only branch $input{'only_on_branch'}.\n"; + $input{"only_on_branch"}=""; + foreach $k (keys %input) { + print "\n" if $input{$k}; + } + print "\n"; + print "
\n"; + } + $formwhere = $scriptwhere; + $formwhere =~ s|Attic/?$|| if ($input{"showattic"}); + print "
\n"; + $input{"showattic"}=!$input{"showattic"}; + foreach $k (keys %input) { + print "\n" if $input{$k}; + } + print "\n"; + print "
\n"; print &html_footer; print "\n"; } elsif (-f $fullname . ',v') { @@ -134,6 +198,9 @@ if (-d $fullname) { "Failed to spawn rlog"); while () { print if ($verbose); + if (/^branch:\s+([\d\.]+)/) { + $curbranch = $1; + } if ($symnames) { if (/^\s+([^:]+):\s+([\d\.]+)/) { $symrev{$1} = $2; @@ -175,7 +242,7 @@ if (-d $fullname) { } $_ = ; print "D:", $_ if ($verbose); - if (m|^date:\s+(\d+)/(\d+)/(\d+)\s+(\d+):(\d+):(\d+);\s+author:\s+(\S+);|) { + 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) { @@ -183,6 +250,7 @@ if (-d $fullname) { } $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: $_"); } @@ -203,12 +271,13 @@ if (-d $fullname) { print "Done sorting revisions\n" if ($verbose); # # HEAD is an artificial tag which is simply the highest tag number on the main -# branch (I think!). Find it by looking through @revorder; it should at least -# be near the beginning (In fact, it *should* be the first commit listed on -# the main branch.) +# 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] =~ /^\d+\.\d+$/) { + if ($revorder[$i] =~ /^(\S*)\.\d+$/ && $headrev eq $1) { if ($revsym{$revorder[$i]}) { $revsym{$revorder[$i]} .= ", "; } @@ -236,8 +305,6 @@ if (-d $fullname) { # If there is no branch A.B.D, then it translates into # the head A.B . # - # This is pure speculation. - # $head = $1; $branch = $3; $regex = $head . "." . $branch; @@ -255,16 +322,27 @@ if (-d $fullname) { } $revsym{$rev} .= ", " if ($revsym{$rev}); $revsym{$rev} .= $_; + if ($rev ne $head) { + $branchpoint{$head} .= ", " if ($branchpoint{$head}); + $branchpoint{$head} .= $_; + } } $sel .= "