[Collab-qa-commits] r1260 - buildstat/trunk/buildstat-server/script/feedme

goneri at alioth.debian.org goneri at alioth.debian.org
Tue Sep 9 12:32:10 UTC 2008


Author: goneri
Date: 2008-09-09 12:32:09 +0000 (Tue, 09 Sep 2008)
New Revision: 1260

Modified:
   buildstat/trunk/buildstat-server/script/feedme/alioth-svn.pl
Log:
I can import of the Alioth snv repository now

Modified: buildstat/trunk/buildstat-server/script/feedme/alioth-svn.pl
===================================================================
--- buildstat/trunk/buildstat-server/script/feedme/alioth-svn.pl	2008-09-09 12:29:08 UTC (rev 1259)
+++ buildstat/trunk/buildstat-server/script/feedme/alioth-svn.pl	2008-09-09 12:32:09 UTC (rev 1260)
@@ -3,14 +3,19 @@
 use strict;
 use warnings;
 
+use lib '/usr/share/buildstat-server/lib';
+
 use LWP::Simple;
+use Config::IniFiles;
 
 use Data::Dumper;
 
+use SvnBuildStat::Schema;
+use SvnBuildStat::Common;
+
 my $content = get("http://svn.debian.org/");
 
 
-print $content;
 my @entries;
 my $team;
 foreach(split ("\n", $content)) {
@@ -22,4 +27,29 @@
     }
 }
 
-print Dumper(\@entries);
+my $cfg = Config::IniFiles->new( -file => "/etc/buildstat-server/buildstat.ini" ) or die "Can't load config file";
+my $schema = SvnBuildStat::Schema->connect(
+    $cfg->val('db', 'dsn'),
+    $cfg->val('db', 'user'),
+    undef,
+    {AutoCommit => 1, debug => 1}
+);
+
+
+my $vcs = $schema->resultset('Vcs')->find_or_create({name => 'svn'});
+
+
+foreach my $entry (@entries) {
+    print $entry->[0].":\n";
+    foreach my $line (`svn ls -R $entry->[1]`) {
+        chomp $line;
+        next if $line =~ /\/tags\//;
+        next if $line =~ /\/branch(|)s\//;
+        next unless $line =~ /trunk\/$/;
+        $line =~ s/\/$//;
+        print " ->".$entry->[1]."$line\n";
+        my $repository = $schema->resultset('Repository')->find_or_create({uri => $entry->[1].$line, vcs_id => $vcs->id});
+        $repository->name($entry->[0]);
+        $repository->update;
+    }
+}




More information about the Collab-qa-commits mailing list