version 1.8, 1997/07/01 22:19:57 |
version 1.10, 1997/11/14 17:36:47 |
Line 31 require 'ctime.pl'; |
|
Line 31 require 'ctime.pl'; |
|
$hsty_base = ""; |
$hsty_base = ""; |
require 'cgi-style.pl'; |
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 = " |
$intro = " |
This is a WWW interface to the FreeBSD CVS tree. |
This is a WWW interface to the FreeBSD CVS tree. |
You can browse the file hierarchy by picking directories |
You can browse the file hierarchy by picking directories |
Line 49 CVS tree, see <A HREF=\"http://www.freebsd.org/~fenner |
|
Line 59 CVS tree, see <A HREF=\"http://www.freebsd.org/~fenner |
|
the CVSWeb distribution site</A>. |
the CVSWeb distribution site</A>. |
<p> |
<p> |
Please send any suggestions, comments, etc. to |
Please send any suggestions, comments, etc. to |
<A HREF=\"mailto:fenner@freebsd.org\">Bill Fenner <fenner@freebsd.org></A> |
<A HREF=\"mailto:fenner\@freebsd.org\">Bill Fenner <fenner\@freebsd.org></A> |
"; |
"; |
$shortinstr = " |
$shortinstr = " |
Click on a directory to enter that directory. Click on a file to display |
Click on a directory to enter that directory. Click on a file to display |
Line 60 chance to display diffs between revisions. |
|
Line 70 chance to display diffs between revisions. |
|
$verbose = $v; |
$verbose = $v; |
($where = $ENV{'PATH_INFO'}) =~ s|^/||; |
($where = $ENV{'PATH_INFO'}) =~ s|^/||; |
$where =~ s|/$||; |
$where =~ s|/$||; |
$fullname = $cvsroot . '/' . $where; |
|
($scriptname = $ENV{'SCRIPT_NAME'}) =~ s|^/?|/|; |
($scriptname = $ENV{'SCRIPT_NAME'}) =~ s|^/?|/|; |
$scriptname =~ s|/$||; |
$scriptname =~ s|/$||; |
$scriptwhere = $scriptname . '/' . $where; |
$scriptwhere = $scriptname . '/' . $where; |
$scriptwhere =~ s|/$||; |
$scriptwhere =~ s|/$||; |
|
|
if (!-d $cvsroot) { |
|
&fatal("500 Internal Error",'$CVSROOT not found!'); |
|
} |
|
|
|
if ($q = $ENV{'QUERY_STRING'}) { |
if ($query = $ENV{'QUERY_STRING'}) { |
foreach (split(/&/, $q)) { |
foreach (split(/&/, $query)) { |
s/%(..)/sprintf("%c", hex($1))/ge; # unquote %-quoted |
s/%(..)/sprintf("%c", hex($1))/ge; # unquote %-quoted |
if (/(\S+)=(.*)/) { |
if (/(\S+)=(.*)/) { |
$input{$1} = $2; |
$input{$1} = $2; |
Line 79 if ($q = $ENV{'QUERY_STRING'}) { |
|
Line 85 if ($q = $ENV{'QUERY_STRING'}) { |
|
$input{$_}++; |
$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) { |
if (-d $fullname) { |
opendir(DIR, $fullname) || &fatal("404 Not Found","$where: $!"); |
opendir(DIR, $fullname) || &fatal("404 Not Found","$where: $!"); |
@dir = readdir(DIR); |
@dir = readdir(DIR); |
Line 97 if (-d $fullname) { |
|
Line 120 if (-d $fullname) { |
|
# provides the results that I want in most browsers. Another |
# provides the results that I want in most browsers. Another |
# case of layout spooging up HTML. |
# case of layout spooging up HTML. |
print "<MENU>\n"; |
print "<MENU>\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 '.') { |
if ($_ eq '.') { |
next; |
next; |
} |
} |
|
if (s|^Attic/||) { |
|
$attic = " (in the Attic)"; |
|
} else { |
|
$attic = ""; |
|
} |
if ($_ eq '..') { |
if ($_ eq '..') { |
next if ($where eq ''); |
next if ($where eq ''); |
($updir = $scriptwhere) =~ s|[^/]+$||; |
($updir = $scriptwhere) =~ s|[^/]+$||; |
print "<IMG SRC=\"/icons/back.gif\"> ", |
print "<IMG SRC=\"/icons/back.gif\"> ", |
&link("Previous Directory",$updir), "<BR>"; |
&link("Previous Directory",$updir . $query), "<BR>"; |
# print "<IMG SRC=???> ", |
# print "<IMG SRC=???> ", |
# &link("Directory-wide diffs", $scriptwhere . '/*'), "<BR>"; |
# &link("Directory-wide diffs", $scriptwhere . '/*'), "<BR>"; |
} elsif (-d $fullname . "/" . $_) { |
} elsif (-d $fullname . "/" . $_) { |
print "<IMG SRC=\"/icons/dir.gif\"> ", |
print "<IMG SRC=\"/icons/dir.gif\"> ", |
&link($_ . "/", $scriptwhere . '/' . $_ . '/'), "<BR>"; |
&link($_ . "/", $scriptwhere . '/' . $_ . '/' . $query), $attic, "<BR>"; |
} elsif (s/,v$//) { |
} elsif (s/,v$//) { |
# TODO: add date/time? How about sorting? |
# TODO: add date/time? How about sorting? |
print "<IMG SRC=\"/icons/text.gif\"> ", |
print "<IMG SRC=\"/icons/text.gif\"> ", |
&link($_, $scriptwhere . '/' . $_), "<BR>"; |
&link($_, $scriptwhere . '/' . |
|
($attic ? "Attic/" : "") . $_ . $query), |
|
$attic, "<BR>"; |
} |
} |
} |
} |
print "</MENU>\n"; |
print "</MENU>\n"; |
|
if ($input{"only_on_branch"}) { |
|
print "<HR><FORM METHOD=\"GET\" ACTION=\"${scriptwhere}\">\n"; |
|
print "Currently showing only branch $input{'only_on_branch'}.\n"; |
|
$input{"only_on_branch"}=""; |
|
foreach $k (keys %input) { |
|
print "<INPUT TYPE=hidden NAME=$k VALUE=$input{$k}>\n" if $input{$k}; |
|
} |
|
print "<INPUT TYPE=SUBMIT VALUE=\"Show all branches\">\n"; |
|
print "</FORM>\n"; |
|
} |
|
$formwhere = $scriptwhere; |
|
$formwhere =~ s|Attic/?$|| if ($input{"showattic"}); |
|
print "<HR><FORM METHOD=\"GET\" ACTION=\"${formwhere}\">\n"; |
|
$input{"showattic"}=!$input{"showattic"}; |
|
foreach $k (keys %input) { |
|
print "<INPUT TYPE=hidden NAME=$k VALUE=$input{$k}>\n" if $input{$k}; |
|
} |
|
print "<INPUT TYPE=SUBMIT VALUE=\""; |
|
print ($input{"showattic"} ? "Show" : "Hide"); |
|
print " attic directories\">\n"; |
|
print "</FORM>\n"; |
print &html_footer; |
print &html_footer; |
print "</BODY></HTML>\n"; |
print "</BODY></HTML>\n"; |
} elsif (-f $fullname . ',v') { |
} elsif (-f $fullname . ',v') { |
Line 178 if (-d $fullname) { |
|
Line 242 if (-d $fullname) { |
|
} |
} |
$_ = <RCS>; |
$_ = <RCS>; |
print "D:", $_ if ($verbose); |
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; |
$yr = $1; |
# damn 2-digit year routines |
# damn 2-digit year routines |
if ($yr > 100) { |
if ($yr > 100) { |
Line 186 if (-d $fullname) { |
|
Line 250 if (-d $fullname) { |
|
} |
} |
$date{$rev} = &timelocal($6,$5,$4,$3,$2 - 1,$yr); |
$date{$rev} = &timelocal($6,$5,$4,$3,$2 - 1,$yr); |
$author{$rev} = $7; |
$author{$rev} = $7; |
|
$state{$rev} = $8; |
} else { |
} else { |
&fatal("500 Internal Error", "Error parsing RCS output: $_"); |
&fatal("500 Internal Error", "Error parsing RCS output: $_"); |
} |
} |
Line 266 if (-d $fullname) { |
|
Line 331 if (-d $fullname) { |
|
} |
} |
print "Done associating revisions with branches\n" if ($verbose); |
print "Done associating revisions with branches\n" if ($verbose); |
print &html_header("CVS log for $where"); |
print &html_header("CVS log for $where"); |
($upwhere = $where) =~ s|[^/]+$||; |
($upwhere = $where) =~ s|(Attic/)?[^/]+$||; |
print "Up to ", &link($upwhere,$scriptname . "/" . $upwhere); |
print "Up to ", &link($upwhere,$scriptname . "/" . $upwhere . $query); |
print "<BR>\n"; |
print "<BR>\n"; |
print "<A HREF=\"#diff\">Request diff between arbitrary revisions</A>\n"; |
print "<A HREF=\"#diff\">Request diff between arbitrary revisions</A>\n"; |
print "<HR NOSHADE>\n"; |
print "<HR NOSHADE>\n"; |
Line 301 if (-d $fullname) { |
|
Line 366 if (-d $fullname) { |
|
$nameprinted{$br}++; |
$nameprinted{$br}++; |
} |
} |
print "\n"; |
print "\n"; |
print "<A HREF=\"$scriptwhere?rev=$_\"><b>$_</b></A>"; |
print "<A HREF=\"$scriptwhere?rev=$_" . |
|
&cvsroot . qq{"><b>$_</b></A>}; |
if (/^1\.1\.1\.\d+$/) { |
if (/^1\.1\.1\.\d+$/) { |
print " <i>(vendor branch)</i>"; |
print " <i>(vendor branch)</i>"; |
} |
} |
Line 344 if (-d $fullname) { |
|
Line 410 if (-d $fullname) { |
|
if ($prevrev[$#prevrev] != 0) { |
if ($prevrev[$#prevrev] != 0) { |
$prev = join(".", @prevrev); |
$prev = join(".", @prevrev); |
print "<BR><A HREF=\"${scriptwhere}.diff?r1=$prev"; |
print "<BR><A HREF=\"${scriptwhere}.diff?r1=$prev"; |
print "&r2=$_\">Diffs to $prev</A>\n"; |
print "&r2=$_" . &cvsroot . qq{">Diffs to $prev</A>\n}; |
# |
# |
# Plus, if it's on a branch, and it's not a vendor branch, |
# Plus, if it's on a branch, and it's not a vendor branch, |
# offer to diff with the immediately-preceding commit if it |
# offer to diff with the immediately-preceding commit if it |
Line 358 if (-d $fullname) { |
|
Line 424 if (-d $fullname) { |
|
@tmp2 = split(/\./, $_); |
@tmp2 = split(/\./, $_); |
if ($#tmp1 < $#tmp2) { |
if ($#tmp1 < $#tmp2) { |
print "; <A HREF=\"${scriptwhere}.diff?r1=$revorder[$i+1]"; |
print "; <A HREF=\"${scriptwhere}.diff?r1=$revorder[$i+1]"; |
print "&r2=$_\">Diffs to $revorder[$i+1]</A>\n"; |
print "&r2=$_" . &cvsroot . |
|
qq{">Diffs to $revorder[$i+1]</A>\n}; |
} |
} |
} |
} |
} |
} |
|
if ($state{$_} eq "dead") { |
|
print "<BR><B><I>FILE REMOVED</I></B>\n"; |
|
} |
print "<PRE>\n"; |
print "<PRE>\n"; |
print &htmlify($log{$_}, 1); |
print &htmlify($log{$_}, 1); |
print "</PRE><HR NOSHADE>\n"; |
print "</PRE><HR NOSHADE>\n"; |
Line 373 if (-d $fullname) { |
|
Line 443 if (-d $fullname) { |
|
print "name using the type-in text box.\n"; |
print "name using the type-in text box.\n"; |
print "</A><P>\n"; |
print "</A><P>\n"; |
print "<FORM METHOD=\"GET\" ACTION=\"${scriptwhere}.diff\">\n"; |
print "<FORM METHOD=\"GET\" ACTION=\"${scriptwhere}.diff\">\n"; |
|
print qq{<input type=hidden name=cvsroot value=$cvstree>\n} |
|
if &cvsroot; |
print "Diffs between \n"; |
print "Diffs between \n"; |
print "<SELECT NAME=\"r1\">\n"; |
print "<SELECT NAME=\"r1\">\n"; |
print "<OPTION VALUE=\"text\" SELECTED>Use Text Field\n"; |
print "<OPTION VALUE=\"text\" SELECTED>Use Text Field\n"; |
Line 396 if (-d $fullname) { |
|
Line 468 if (-d $fullname) { |
|
print "a single branch.\n"; |
print "a single branch.\n"; |
print "</A><P>\n"; |
print "</A><P>\n"; |
print "<FORM METHOD=\"GET\" ACTION=\"$scriptwhere\">\n"; |
print "<FORM METHOD=\"GET\" ACTION=\"$scriptwhere\">\n"; |
|
print qq{<input type=hidden name=cvsroot value=$cvstree>\n} |
|
if &cvsroot; |
print "Branch: \n"; |
print "Branch: \n"; |
print "<SELECT NAME=\"only_on_branch\">\n"; |
print "<SELECT NAME=\"only_on_branch\">\n"; |
|
print "<OPTION VALUE=\"\""; |
|
print " SELECTED" if ($input{"only_on_branch"} eq ""); |
|
print ">Show all branches\n"; |
foreach (sort @branchnames) { |
foreach (sort @branchnames) { |
print "<OPTION>${_}\n"; |
print "<OPTION"; |
|
print " SELECTED" if ($input{"only_on_branch"} eq $_); |
|
print ">${_}\n"; |
} |
} |
print "</SELECT>\n"; |
print "</SELECT>\n"; |
print "<INPUT TYPE=SUBMIT VALUE=\"View Branch\">\n"; |
print "<INPUT TYPE=SUBMIT VALUE=\"View Branch\">\n"; |
Line 408 if (-d $fullname) { |
|
Line 487 if (-d $fullname) { |
|
print "</BODY></HTML>\n"; |
print "</BODY></HTML>\n"; |
} elsif ($fullname =~ s/\.diff$// && -f $fullname . ",v" && |
} elsif ($fullname =~ s/\.diff$// && -f $fullname . ",v" && |
$input{'r1'} && $input{'r2'}) { |
$input{'r1'} && $input{'r2'}) { |
|
# Allow diffs using the ".diff" extension |
|
# so that browsers that default to the URL |
|
# for a save filename don't save diff's as |
|
# e.g. foo.c |
&dodiff($fullname, $input{'r1'}, $input{'tr1'}, |
&dodiff($fullname, $input{'r1'}, $input{'tr1'}, |
$input{'r2'}, $input{'tr2'}, $input{'f'}); |
$input{'r2'}, $input{'tr2'}, $input{'f'}); |
exit; |
exit; |
|
} elsif (($newname = $fullname) =~ s|/([^/]+)$|/Attic/$1| && |
|
-f $newname . ",v") { |
|
# The file has been removed and is in the Attic. |
|
# Send a redirect pointing to the file in the Attic. |
|
($newplace = $scriptwhere) =~ s|/([^/]+)$|/Attic/$1|; |
|
&redirect($newplace); |
|
exit; |
} elsif (0 && (@files = &safeglob($fullname . ",v"))) { |
} elsif (0 && (@files = &safeglob($fullname . ",v"))) { |
print "Content-type: text/plain\n\n"; |
print "Content-type: text/plain\n\n"; |
print "You matched the following files:\n"; |
print "You matched the following files:\n"; |
|
|
print $_; |
print $_; |
} |
} |
close(RCSDIFF); |
close(RCSDIFF); |
|
} |
|
|
|
sub cvsroot { |
|
return '' if $cvstree eq $cvstreedefault; |
|
return "&cvsroot=" . $cvstree; |
} |
} |