=================================================================== RCS file: /cvs/cvsweb/cvsweb.cgi,v retrieving revision 1.1 retrieving revision 1.7 diff -u -p -r1.1 -r1.7 --- cvsweb/cvsweb.cgi 1996/09/28 23:31:06 1.1 +++ cvsweb/cvsweb.cgi 1997/04/30 18:25:05 1.7 @@ -28,6 +28,9 @@ require 'timelocal.pl'; require 'ctime.pl'; +$hsty_base = ""; +require 'cgi-style.pl'; + $cvsroot = '/home/ncvs'; $intro = " This is a WWW interface to the FreeBSD CVS tree. @@ -41,6 +44,10 @@ diffs between that revision and the previous one, and a form at the bottom of the page that allows you to display diffs between arbitrary revisions.
+If you would like to use this CGI script on your own web server and +CVS tree, see +the CVSWeb distribution site. +
Please send any suggestions, comments, etc. to Bill Fenner <fenner@freebsd.org> "; @@ -62,33 +69,30 @@ $scriptwhere =~ s|/$||; if (!-d $cvsroot) { &fatal("500 Internal Error",'$CVSROOT not found!'); } + +if ($q = $ENV{'QUERY_STRING'}) { + foreach (split(/&/, $q)) { + s/%(..)/sprintf("%c", hex($1))/ge; # unquote %-quoted + if (/(\S+)=(.*)/) { + $input{$1} = $2; + } else { + $input{$_}++; + } + } +} if (-d $fullname) { -# Something that would be nice to support, although I have no real -# good idea of how, would be to get full directory diff's, using -# symbolic names (revision numbers would be meaningless). -# The problem is finding a list of symbolic names that is common -# to all the files in the directory. -# opendir(DIR, $fullname) || &fatal("404 Not Found","$where: $!"); @dir = readdir(DIR); closedir(DIR); - print "Content-type: text/html\n\n"; - print "
Current directory: /$where\n"; - print "
- print "Content-type: text/plain\n\n"; - open(RCSDIFF, "rcsdiff $difftype -r$rev1 -r$rev2 '$fullname' 2>&1 |") || - &fail("500 Internal Error", "Couldn't rcsdiff: $!"); -# -#=================================================================== -#RCS file: /home/ncvs/src/sys/netinet/tcp_output.c,v -#retrieving revision 1.16 -#retrieving revision 1.17 -#diff -c -r1.16 -r1.17 -#*** /home/ncvs/src/sys/netinet/tcp_output.c 1995/11/03 22:08:08 1.16 -#--- /home/ncvs/src/sys/netinet/tcp_output.c 1995/12/05 17:46:35 1.17 -# -# Ideas: -# - nuke the stderr output if it's what we expect it to be -# - Add "no differences found" if the diff command supplied no output. -# -#*** src/sys/netinet/tcp_output.c 1995/11/03 22:08:08 1.16 -#--- src/sys/netinet/tcp_output.c 1995/12/05 17:46:35 1.17 RELENG_2_1_0 -# (bogus example, but...) -# - if ($difftype eq '-u') { - $f1 = '---'; - $f2 = '\+\+\+'; - } else { - $f1 = '\*\*\*'; - $f2 = '---'; - } - while () { - if (m|^$f1 $cvsroot|o) { - s|$cvsroot/||o; - if ($sym1) { - chop; - $_ .= " " . $sym1 . "\n"; - } - } elsif (m|^$f2 $cvsroot|o) { - s|$cvsroot/||o; - if ($sym2) { - chop; - $_ .= " " . $sym2 . "\n"; - } - } - print $_; - } - close(RCSDIFF); - exit; } + if ($input{'r1'} && $input{'r2'}) { + &dodiff($fullname, $input{'r1'}, $input{'tr1'}, + $input{'r2'}, $input{'tr2'}, $input{'f'}); + exit; + } open(RCS, "rlog '$fullname'|") || &fatal("500 Internal Error", "Failed to spawn rlog"); while ( ) { @@ -262,6 +150,12 @@ print "
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 @@ -334,6 +228,7 @@ print "
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". @@ -364,15 +259,12 @@ print "
$sel .= "
\n"; - print "
\n"; -print "\n"; + print "
\n"; + print &html_footer; print "\n"; +} elsif ($fullname =~ s/\.diff$// && -f $fullname . ",v" && + $input{'r1'} && $input{'r2'}) { + &dodiff($fullname, $input{'r1'}, $input{'tr1'}, + $input{'r2'}, $input{'tr2'}, $input{'f'}); + exit; +} elsif (0 && (@files = &safeglob($fullname . ",v"))) { + print "Content-type: text/plain\n\n"; + print "You matched the following files:\n"; + print join("\n", @files); + # Find the tags from each file + # Display a form offering diffs between said tags } else { + # Assume it's a module name with a potential path following it. + ($module = $where) =~ s|/.*||; + $xtra = $&; + # Is there an indexed version of modules? + if (open(MODULES, "$cvsroot/CVSROOT/modules")) { + while (+ print "Content-type: text/plain\n\n"; + open(RCSDIFF, "rcsdiff $difftype -r$rev1 -r$rev2 '$fullname' 2>&1 |") || + &fail("500 Internal Error", "Couldn't rcsdiff: $!"); +# +#=================================================================== +#RCS file: /home/ncvs/src/sys/netinet/tcp_output.c,v +#retrieving revision 1.16 +#retrieving revision 1.17 +#diff -c -r1.16 -r1.17 +#*** /home/ncvs/src/sys/netinet/tcp_output.c 1995/11/03 22:08:08 1.16 +#--- /home/ncvs/src/sys/netinet/tcp_output.c 1995/12/05 17:46:35 1.17 +# +# Ideas: +# - nuke the stderr output if it's what we expect it to be +# - Add "no differences found" if the diff command supplied no output. +# +#*** src/sys/netinet/tcp_output.c 1995/11/03 22:08:08 1.16 +#--- src/sys/netinet/tcp_output.c 1995/12/05 17:46:35 1.17 RELENG_2_1_0 +# (bogus example, but...) +# + if ($difftype eq '-u') { + $f1 = '---'; + $f2 = '\+\+\+'; + } else { + $f1 = '\*\*\*'; + $f2 = '---'; + } + while () { + if (m|^$f1 $cvsroot|o) { + s|$cvsroot/||o; + if ($sym1) { + chop; + $_ .= " " . $sym1 . "\n"; + } + } elsif (m|^$f2 $cvsroot|o) { + s|$cvsroot/||o; + if ($sym2) { + chop; + $_ .= " " . $sym2 . "\n"; + } + } + print $_; + } + close(RCSDIFF); }