#!/usr/bin/env perl use strict; use warnings; use TheSchwartz; my $path = shift; my $rev = shift; my $database = +{ dsn => shift, user => shift, pass => shift, }; sub svnlook { my($cmd, $path) = @_; my $svnlook = '/usr/local/bin/svnlook'; open my $fh, '-|', $svnlook, $cmd, $path or die; local $/; <$fh>; } my $info = svnlook info => $path; my $changed = svnlook changed => $path; my($author, $date, $comment_length, @comments) = split /\n/, $info; $date =~ s/ \(.+$//; my $comment = join "\n", @comments; my @files = map { my($status, $path) = $_ =~ /^(\S+)\s+(.+)$/; +{ status => $status, path => $path, }; } split /\n/, $changed; my $commit = { rev => $rev, author => $author, date => $date, comment => $comment, files => \@files, }; my $client = TheSchwartz->new( databases => [ $database ] ); $client->insert( 'CodeRepos::CommitPing::Worker' => $commit );