Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Apr 2004 14:21:33 -0500
From:      Jon Noack <noackjr@alumni.rice.edu>
To:        =?ISO-8859-1?Q?Ville_Skytt=E4?= <scop@FreeBSD.org>
Cc:        freebsd-cvsweb@FreeBSD.org
Subject:   Re: Linking to latest revision of a file
Message-ID:  <4085783D.9020005@alumni.rice.edu>
In-Reply-To: <1082486185.5301.332.camel@bobcat.mine.nu>
References:  <20040420143806.GB13838@nosc.ja.net> <1082486185.5301.332.camel@bobcat.mine.nu>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------010608070407000000040404
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

On 4/20/2004 1:36 PM, Ville Skytt=E4 wrote:
> On Tue, 2004-04-20 at 17:38, Rob Evans wrote:
>> CVSweb is up and running, but what I would like to do is link to
>> "the newest" revision of files from a separate HTML page.  In other
>> words, a link along the lines of the following (but which actually
>> works):
>>=20
>> http://<server>/cgi-bin/cvsweb.cgi/<filename>?rev=3DHEAD
>=20
> Hm, *that* should actually work.  Ditto for "?rev=3D."  It's a bug in=20
> CVSweb 3.0, but works in 2.0.x; will take a look.

Diff from slightly-modified 3.0.0 attached (might be a little fuzz, but=20
hopefully it will still apply cleanly).  I took the easy way out and=20
just made it a separate if.  Note that this is a definite hack and that=20
I didn't really bother understanding everything -- it Just Works(tm)...

Either '?rev=3DHEAD' or '?rev=3D.' should work.

Jon Noack

--------------010608070407000000040404
Content-Type: text/plain;
 name="cvsweb.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="cvsweb.diff"

--- cvsweb.cgi.bak	Fri Feb 27 11:10:17 2004
+++ cvsweb.cgi	Tue Apr 20 14:12:21 2004
@@ -416,9 +416,13 @@
       next;
     }
     my ($rev, $tag) = split(/:/, $t, 2);
-    ($input{$p}) = ($rev =~ /^(\d+(?:\.\d+)+)$/)
-      or fatal('500 Internal Error',
-               'Invalid revision: <code>%s=%s</code>', $p, $t);
+    if ($rev eq 'HEAD' || $rev eq '.') {
+      $input{$p} = $rev;
+    } else {
+      ($input{$p}) = ($rev =~ /^(\d+(?:\.\d+)+)$/)
+        or fatal('500 Internal Error',
+                 'Invalid revision: <code>%s=%s</code>', $p, $t);
+    }
     if (defined($tag)) {
       ($tag) = ($tag =~ VALID_TAG1)
         or fatal('500 Internal Error',

--------------010608070407000000040404--



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