Linking to latest revision of a file

Jon Noack noackjr at alumni.rice.edu
Tue Apr 20 12:21:44 PDT 2004


On 4/20/2004 1:36 PM, Ville Skyttä 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):
>> 
>> http://<server>/cgi-bin/cvsweb.cgi/<filename>?rev=HEAD
> 
> Hm, *that* should actually work.  Ditto for "?rev=."  It's a bug in 
> 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 
hopefully it will still apply cleanly).  I took the easy way out and 
just made it a separate if.  Note that this is a definite hack and that 
I didn't really bother understanding everything -- it Just Works(tm)...

Either '?rev=HEAD' or '?rev=.' should work.

Jon Noack
-------------- next part --------------
--- 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',


More information about the freebsd-cvsweb mailing list