You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2005/10/31 08:16:56 UTC

svn commit: r329764 - in /spamassassin/trunk/masses/rule-qa/automc: gen_info_xml ruleqa.cgi

Author: jm
Date: Sun Oct 30 23:16:51 2005
New Revision: 329764

URL: http://svn.apache.org/viewcvs?rev=329764&view=rev
Log:
fixes

Modified:
    spamassassin/trunk/masses/rule-qa/automc/gen_info_xml
    spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi

Modified: spamassassin/trunk/masses/rule-qa/automc/gen_info_xml
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/masses/rule-qa/automc/gen_info_xml?rev=329764&r1=329763&r2=329764&view=diff
==============================================================================
--- spamassassin/trunk/masses/rule-qa/automc/gen_info_xml (original)
+++ spamassassin/trunk/masses/rule-qa/automc/gen_info_xml Sun Oct 30 23:16:51 2005
@@ -1,6 +1,9 @@
 #!/local/perl586/bin/perl -w
 my $automcdir = "/home/automc/svn/spamassassin/masses/rule-qa/automc";
 
+# need this to ensure that 'svn log' will include ALL changes
+my $svn_checkins_root = "../../..";
+
 use XML::Simple;
 
 use strict;
@@ -15,6 +18,8 @@
 
 die "no conf{html}: $conf{html}" unless (-d $conf{html});
 
+my $svn_log;
+
 # all known date/revision combos.  warning: could get slow in future
 my @daterevs = get_all_daterevs();
 
@@ -22,6 +27,7 @@
   my $drdir = get_datadir_for_daterev($dr);
   if (-f "$drdir/info.xml" && -s _) {
     print "$drdir/info.xml: good\n";
+    next;
   }
 
   print "$drdir/info.xml: creating...\n";
@@ -44,18 +50,17 @@
     includes_net => 0
   };
 
-  if (open (IN, "svn log --xml -r$rev |")) {
-    eval {
-      my $xml = join('', <IN>);
-      my $ref = XMLin($xml);
-      $info->{msg} = $ref->msg;
-      $info->{checkin_date} = $ref->date;   # '2005-10-31T04:20:10.686485Z'
-      $info->{author} = $ref->author;
-    };
-    if ($@) {
-      warn "svn xml: $@";
-    }
-    close IN or warn "svn failed: $!";
+  if (!$svn_log) {
+    get_svn_log();
+  }
+
+  foreach my $logentry (@{$svn_log->{logentry}}) {
+    next if ($logentry->{revision} > $rev);
+    $info->{msg} = $logentry->{msg} || '';
+    $info->{checkin_rev} = $logentry->{revision} || '';
+    $info->{checkin_date} = $logentry->{date} || '';   # '2005-10-31T04:20:10.686485Z'
+    $info->{author} = $logentry->{author} || '';
+    last;
   }
 
   if (-f "$drdir/NET.all") {
@@ -77,9 +82,23 @@
   return $conf{html}."/".$npath."/";
 }
 
-=cut
-
-to install, add this line to httpd.conf:
+sub get_svn_log {
+  print "getting svn log...\n";
+  if (open (IN, "svn log --xml $svn_checkins_root |")) {
+    eval {
+      my $xml = join('', <IN>);
+      $svn_log = XMLin($xml);
+    };
+    if ($@) {
+      die "svn xml: $@";
+    }
+    close IN or die "svn failed: $!";
+  }
+  if (!$svn_log) {
+    die "no svn log --xml";
+  }
+  print "got ".(scalar @{$svn_log->{logentry}})." log entries\n";
 
-  ScriptAlias /ruleqa "/path/to/spamassassin/automc/ruleqa.cgi"
+  # use Data::Dumper; print Dumper($svn_log); die;
+}
 

Modified: spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi?rev=329764&r1=329763&r2=329764&view=diff
==============================================================================
--- spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi (original)
+++ spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi Sun Oct 30 23:16:51 2005
@@ -802,15 +802,20 @@
   if (-f $fname) {
     eval {
       my $info = XMLin($fname);
+
+      my $cdate = $info->{checkin_date};
+      $cdate =~ s/\.\d+Z$//;
+      $cdate =~ s/T/ /;
+
       my $net = $info->{includes_net} ?
-            "[net]" :
-            "";
+            "[net]" : "";
       
       $txt = qq{
 
         $info->{date} <br/>
         $info->{rev} <br/>
-        $info->{checkin_date} <br/>
+        $cdate <br/>
+        $info->{checkin_rev} <br/>
         $info->{author} <br/>
         $net