]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Rcs/svn.pm
* Make auth methods pluggable.
[ikiwiki.git] / IkiWiki / Rcs / svn.pm
index f01735afe74c86d5c3279ec0bb1ea1beaa83152e..2d3ad046caf95c171bbc0d1d2b56b0eeee738b42 100644 (file)
@@ -1,5 +1,4 @@
 #!/usr/bin/perl
-# For subversion support.
 
 use warnings;
 use strict;
@@ -123,11 +122,13 @@ sub rcs_recentchanges ($) { #{{{
        
        return unless -d "$config{srcdir}/.svn";
 
-       eval q{use CGI 'escapeHTML'};
-       eval q{use Date::Parse};
-       eval q{use Time::Duration};
-       eval q{use XML::SAX};
-       eval q{use XML::Simple};
+       eval q{
+               use Date::Parse;
+               use Time::Duration;
+               use XML::SAX;
+               use XML::Simple;
+       };
+       error($@) if $@;
 
        # avoid using XML::SAX::PurePerl, it's buggy with UTF-8 data
        my @parsers = map { ${$_}{Name} } @{XML::SAX->parsers()};
@@ -153,13 +154,10 @@ sub rcs_recentchanges ($) { #{{{
                my $rev = $logentry->{revision};
                my $user = $logentry->{author};
 
-               my $date = $logentry->{date};
-               $date =~ s/T/ /;
-               $date =~ s/\.\d+Z$//;
-               my $when=concise(ago(time - str2time($date, 'UTC')));
+               my $when=time - str2time($logentry->{date}, 'UTC');
 
                foreach my $msgline (split(/\n/, $logentry->{msg})) {
-                       push @message, { line => escapeHTML($msgline) };
+                       push @message, { line => $msgline };
                }
 
                my $committype="web";
@@ -180,12 +178,12 @@ sub rcs_recentchanges ($) { #{{{
                        $diffurl=~s/\[\[r1\]\]/$rev - 1/eg;
                        $diffurl=~s/\[\[r2\]\]/$rev/g;
                        push @pages, {
-                               link => htmllink("", "", pagename($file), 1),
+                               page => pagename($file),
                                diffurl => $diffurl,
                        } if length $file;
                }
                push @ret, { rev => $rev,
-                       user => htmllink("", "", $user, 1),
+                       user => $user,
                        committype => $committype,
                        when => $when,
                        message => [@message],
@@ -246,6 +244,7 @@ sub rcs_notify () { #{{{
                );
                
                eval q{use Mail::Sendmail};
+               error($@) if $@;
                foreach my $email (@email_recipients) {
                        sendmail(
                                To => $email,
@@ -259,7 +258,6 @@ sub rcs_notify () { #{{{
 
 sub rcs_getctime ($) { #{{{
        my $file=shift;
-       eval q{use Date::Parse};
 
        my $svn_log_infoline=qr/^r\d+\s+\|\s+[^\s]+\s+\|\s+(\d+-\d+-\d+\s+\d+:\d+:\d+\s+[-+]?\d+).*/;
                
@@ -281,6 +279,8 @@ sub rcs_getctime ($) { #{{{
                return 0;
        }
                
+       eval q{use Date::Parse};
+       error($@) if $@;
        $date=str2time($date);
        debug("found ctime ".localtime($date)." for $file");
        return $date;