Commits

Anonymous committed d144195

SVN-RaWeb-Light: 1. Fixed a bug with the should_be_dir not initialized to
a true value when the path is the root.

2. The script now accepts a rev CGI parameter to browse the repository in
a certain non-HEAD revision.

  • Participants
  • Parent commits 87c5a34

Comments (0)

Files changed (2)

-* Make sure paths ending with slash are directories and those that don't
-are files.
+* Add the rev parameter.
+
+* Implement Caching.
+

File lib/SVN/RaWeb/Light.pm

     }
 
     $path =~ s!^/!!;
-    my $should_be_dir = ($path =~ s{/$}{});
+    my $should_be_dir = (($path eq "") || ($path =~ s{/$}{}));
 
-    my $rev_num = $svn_ra->get_latest_revnum();
+    my $latest_rev = $svn_ra->get_latest_revnum();
+
+    my $rev_num = (abs(int($cgi->param('rev'))) || $latest_rev);
+
+    my $url_suffix = (($rev_num == $latest_rev) ? "" : "?rev=$rev_num");
 
     my $node_kind = $svn_ra->check_path($path, $rev_num);
 
         print "<body>\n";
         print "<h2>$title</h2>\n";
         print "<ul>\n";
-        print "<li><a href=\"../\">..</a></li>\n";
+        print "<li><a href=\"../$url_suffix\">..</a></li>\n";
         print map { my $escaped_name = CGI::escapeHTML($_); 
             if ($dir_contents->{$_}->kind() eq $SVN::Node::dir)
             {
                 $escaped_name .= "/";
             }
-            "<li><a href=\"$escaped_name\">$escaped_name</a></li>\n"
+            "<li><a href=\"$escaped_name$url_suffix\">$escaped_name</a></li>\n"
             } sort { $a cmp $b } keys(%$dir_contents);
         print "</ul>\n";
         print "</body></html>\n";