Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Aug 2000 19:48:19 +0100
From:      Ben Smithurst <ben@FreeBSD.org>
To:        Josef Karthauser <joe@pavilion.net>
Cc:        Alfred Perlstein <bright@wintelcom.net>, Doug Barton <Doug@gorean.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvsweb links in cvs commit messages
Message-ID:  <20000824194818.B28527@strontium.scientia.demon.co.uk>
In-Reply-To: <20000824175901.C8962@pavilion.net>
References:  <20000823093626.Z4854@fw.wintelcom.net> <Pine.BSF.4.21.0008231154070.7876-100000@dt051n1f.san.rr.com> <20000823120642.C4854@fw.wintelcom.net> <20000823202312.S20036@strontium.scientia.demon.co.uk> <20000824175901.C8962@pavilion.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Josef Karthauser wrote:

> On a related thing it would be really useful to be able to do:
> 
> http://www.FreeBSD.org/cgi/cvsweb.cgi/src/bin/chmod/chmod.1?rev=HEAD
> 
> to pull out head release of a file.

Ah, now that's easy. :-) Try the diff below. revcmp() doesn't work for
symbolic names, but I don't think that's too important.  It doesn't
work for diffs between say HEAD and RELENG_4 though, and trying the
equivalent command at the prompt gives:

ben@magnesium:~/bsdwork/www/en/cgi$ rcsdiff -u -rHEAD -rRELENG_4 /usr/cvs/src/Makefile.inc1
===================================================================
RCS file: /usr/cvs/src/Makefile.inc1,v
rcsdiff: /usr/cvs/src/Makefile.inc1,v: Symbolic name `HEAD' is undefined.

How would you get around that?  You can't use cvs itself, unless you
have a checked out version. :-(

ben@magnesium:~$ cvs -Rd /usr/cvs diff -rHEAD -rRELENG_4 src/Makefile.inc1
cvs [diff aborted]: no such directory `src'

hmm.

Index: cvsweb.cgi
===================================================================
RCS file: /usr/cvs/www/en/cgi/cvsweb.cgi,v
retrieving revision 1.47
diff -u -r1.47 cvsweb.cgi
--- cvsweb.cgi	2000/08/15 08:47:40	1.47
+++ cvsweb.cgi	2000/08/24 18:42:11
@@ -960,6 +960,8 @@
 	my(@r2) = split(/\./, $rev2);
 	my($a,$b);
 
+	return 0 if $rev1 =~ /[A-Za-z_]/ || $rev2 =~ /[A-Za-z_]/;
+
 	while (($a = shift(@r1)) && ($b = shift(@r2))) {
 	    if ($a != $b) {
 		return $a <=> $b;
@@ -1070,7 +1072,7 @@
 
     # make sure the revisions a wellformed, for security
     # reasons ..
-    if (!($rev =~ /^[\d\.]+$/)) {
+    if (!($rev =~ /^[A-Za-z_\d\.]+$/)) {
 	&fatal("404 Not Found",
 		"Malformed query \"$ENV{QUERY_STRING}\"");
     }
@@ -1223,7 +1225,7 @@
 
     # make sure the revisions a wellformed, for security
     # reasons ..
-    if (defined($rev) && !($rev =~ /^[\d\.]+$/)) {
+    if (defined($rev) && !($rev =~ /^[A-Za-z_\d\.]+$/)) {
 	&fatal("404 Not Found",
 		"Malformed query \"$ENV{QUERY_STRING}\"");
     }
@@ -1378,7 +1380,7 @@
 	}
 	# make sure the revisions a wellformed, for security
 	# reasons ..
-	if (!($rev1 =~ /^[\d\.]+$/) || !($rev2 =~ /^[\d\.]+$/)) {
+	if (!($rev1 =~ /^[A-Za-z_\d\.]+$/) || !($rev2 =~ /^[A-Za-z_\d\.]+$/)) {
 	    &fatal("404 Not Found",
 		    "Malformed query \"$ENV{QUERY_STRING}\"");
 	}
-- 
Ben Smithurst / ben@FreeBSD.org / PGP: 0x99392F7D


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000824194818.B28527>