Log::Accounting::SVN - Accounting svn repository


Log-Accounting-SVN documentation Contained in the Log-Accounting-SVN distribution.

Index


Code Index:

NAME

Top

  Log::Accounting::SVN - Accounting svn repository

SYNOPSIS

Top

  my $acc = Log::Accounting::SVN->new(repository => 'svn://');
  $acc->process->report;

DESCRIPTION

Top

This module make use of Algorithm::Accounting and SVN::Log to do simple accounting of any subversion repository (not necessarily local, as long as you can do "svn log" to). The installed svn-accounting.pl script demostrate a simple use to this module, you may try:

  svn-accounting.pl http://svn.collab.net/repos/svn/

This will show the basic accounting information of subversion developers.

So far it's quite simple and no big deal, different fields will be accounted in the future.

COPYRIGHT

Top


Log-Accounting-SVN documentation Contained in the Log-Accounting-SVN distribution.

package Log::Accounting::SVN;
use strict;
use warnings;
use Spiffy '-Base';
use Algorithm::Accounting;
use SVN::Log;
our $VERSION = '0.01';

field 'repository';
field 'quiet';

field '_algo';

sub process {
  $self->repository || die "Must set repository\n";
  my $acc = Algorithm::Accounting->new(fields => [qw/author/]);

  $self->_algo($acc);

  my $append = sub {
    my ($paths,$revision,$author,$date,$message) = @_;
    unless($self->quiet) { print STDERR "$revision\r" if($revision); }
    $acc->append_data([[ $author ]]) if($author);
  };

  SVN::Log::retrieve ({
		       repository => $self->repository,
		       start => 1,
		       end   => -1,
		       callback => $append
		      });
  return $self;
}

sub report {
  my $algo = $self->_algo || die("Can't report without algo obj");
  $algo->report;
}

sub result {
  my $algo = $self->_algo || die("Can't return result without algo obj");
  $algo->result(@_);
}

1;

__END__