%# Never underestimate the bandwidth of a station wagon full of tapes. %# -- Dr. Warren Jackson, Director, UTCS <%PERL> my $basepath = $m->fetch_comp("/Foundry/Project/Source/index.html")->source_dir; require SVN::Web; require File::Spec; my $tmpdir = File::Spec->tmpdir . '/svn'; mkdir $tmpdir unless -d $tmpdir; SVN::Web::set_config({ reposparent => "$RT::VarPath/Foundry/svn", tmpdir => $tmpdir, templatedir => "$basepath/template", map +( "\L$_\E_class" => "SVN::Web::$_" ), qw(Branch Branch Checkout Diff Log Revision RSS Template) }); my (undef, $repos, $action, $path) = split ('/', ($r->path_info), 4); $repos ||= eval { $QueueObj->OriginObj->CustomFieldValue('UnixName') } || 'local'; $action ||= 'browse'; $path ||= ''; #return if $m->cache_self( key => join('/', $repos, $action, $path), '1m' ); my $is_verbatim = ($action =~ /^(?:checkout|diff|rss)$/); $m->flush_buffer if $RT::DoFlush and !$is_verbatim; my $req = bless({}, 'RTx::Foo'); { package RTx::Foo; our $AUTOLOAD; *AUTOLOAD = sub { my $self = shift; my $meth = $AUTOLOAD; $meth =~ s/.*:://; $HTML::Mason::Commands::r->$meth(@_); }; *print = sub { my $self = shift; my $output = Encode::decode( utf8 => Encode::encode( latin1 => shift ) ); $HTML::Mason::Commands::m->print( $output ); }; }; eval { SVN::Web::run({ repos => $repos, action => $action, path => '/'.$path, lang => $session{CurrentUser}->LanguageHandle->language_tag, cgi => CGI->new(\%ARGS), request => $req, $is_verbatim ? ( output_sub => sub { $m->clear_buffer; SVN::Web::mod_perl_output(@_); }, ) : ( output_sub => \&SVN::Web::mod_perl_output, ), tmpdir => $tmpdir, params => \%ARGS, script => "${RT::WebURL}Foundry/Project/Source/index.html", }); 1; }; $m->print($@) if $@; if ($is_verbatim) { $m->abort; } else { if (!$RT::SubversionHost) { $RT::SubversionHost = $ENV{WEB_HOST} || $RT::WebHost; $RT::SubversionHost =~ s/rt|www/svn/i; } my $uri = "http://$RT::SubversionHost/repos/$repos/"; $m->print("