SVN-SVNLook-0.04/0000755€fóè€m™òn0000000000010661354427020426 5ustar sscottoABAOFFICE\domain users00000000000000SVN-SVNLook-0.04/Build.PL0000444€fóè€m™òn0000000047710661354427021730 0ustar sscottoABAOFFICE\domain users00000000000000use Module::Build; my $build = Module::Build->new ( module_name => 'SVN::SVNLook', license => 'perl', create_makefile_pl => 'passthrough', dist_author => 'Salvatore E. ScottoDiLuzio sal.scotto@gmail.com', dist_abstract => 'Module to aid in creating subversion hooks' ); $build->create_build_script; SVN-SVNLook-0.04/Changes0000444€fóè€m™òn0000000052210661354427021716 0ustar sscottoABAOFFICE\domain users00000000000000Revision history for Perl extension SVN::SVNLook. 0.01 Wed Sep 15 10:48:31 2004 - original version; created by h2xs 1.23 with options -A -X SVN::SVNLook 0.02 Wed Apr 27 14:30:00 2005 - Updating code to reflact changes made my Kevin Semande 0.03 Thursday Dec 29 09:15:00 2005 - Added Transaction support via named params SVN-SVNLook-0.04/lib/0000755€fóè€m™òn0000000000010661354427021174 5ustar sscottoABAOFFICE\domain users00000000000000SVN-SVNLook-0.04/lib/SVN/0000755€fóè€m™òn0000000000010661354427021642 5ustar sscottoABAOFFICE\domain users00000000000000SVN-SVNLook-0.04/lib/SVN/SVNLook.pm0000444€fóè€m™òn0000002016110661354427023471 0ustar sscottoABAOFFICE\domain users00000000000000package SVN::SVNLook; use strict; use warnings; use Carp qw(cluck); our $VERSION = 0.04; =head1 NAME SVN::SVNLook - Perl wrapper to the svnlook command. =head1 SYNOPSIS use SVN::SVNLook; my $revision = 1; my $svnlook = SVN::SVNLook->new(repo => 'repo url', cmd => 'path to svn look'); my ($author,$date,$logmessage) = $svnlook->info(revision => $revision); print "Author $author\n"; print "Date $date\n"; print "LogMessage $logmessage\n"; =head1 DESCRIPTION SVN::SVNLook runs the command line client. This module was created to make adding hooks script easier to manipulate. =cut =head1 METHODs =head2 youngest youngest (); Perform the youngest command on the repository. Returns the revision number of the most recent revision as a scalar. =head2 info info (revision=>$revision); Perform the info command, for a given revision or transaction using named parameters, or a single parameter will be assumed to mean revision for backwards compatibility. The information returned is an array containing author, date, and log message. If no $revision is specified, info for the youngest revision is returned. =head2 author author (revision=>$revision); Perform the author command, for a given revision or transaction using named parameters or a single parameter will be assumed to mean revision for backwards compatibility. The information returned is the author message. If no $revision or transaction is specified, author for the youngest revision is returned. =head2 dirschanged dirschanged (revision=>$revision) Performs the dirs-changed command, for a given revision or transaction using named parameters, or a single parameter will be assumed to mean revision for backwards compatibility. This method returns a boolean and an array reference. =head2 fileschanged fileschanged (revision=>$revision) Performs the changed command, for a given revision or transaction using named parameters or a single parameter will be assumed to mean revision for backwards compatibility this method returns 3 array references added, deleted and modified. =head2 diff diff (revision=>$revision) Performs the diff command, for a given revision or transaction using named parameters or a single parameter will be assumed to mean revision for backwards compatability this method returns a hash reference, with each file being the key and value being the diff info. =cut sub new { my $self = {}; my $class = shift; %$self = @_; $self->{repo} ||= $self->{target}; die "no repository specified" unless $self->{repo}; return bless $self, $class; } sub youngest { my $self = shift; my ($rev) = _read_from_process($self->{cmd}, 'youngest', $self->{repo}); return $rev; } sub info { my $self = shift; my %args; if ($#_ == 0) { $args{revision} = shift; } else { %args = @_; } my @svnlooklines = _read_from_process( $self->{cmd}, 'info', $self->{repo}, ($args{revision} ? ('-r', $args{revision}) : ()), ($args{transaction} ? ('-t', $args{transaction}) : ()), ); my $author = shift @svnlooklines; # author of this change my $date = shift @svnlooklines; # date of change shift @svnlooklines; # log message size my @log = map { "$_\n" } @svnlooklines; my $logmessage = join('',@log); return ($author,$date,$logmessage); } sub author { my $self = shift; my %args; if ($#_ == 0) { $args{revision} = shift; } else { %args = @_; } my @svnlooklines = _read_from_process( $self->{cmd}, 'author', $self->{repo}, ($args{revision} ? ('-r', $args{revision}) : ()), ($args{transaction} ? ('-t', $args{transaction}) : ()), ); return $svnlooklines[0]; # author of this change } sub dirschanged { my $self = shift; my %args; if ($#_ == 0) { $args{revision} = shift; } else { %args = @_; } # Figure out what directories have changed using svnlook. my @dirschanged = _read_from_process( $self->{cmd}, 'dirs-changed', $self->{repo}, ($args{revision} ? ('-r', $args{revision}) : ()), ($args{transaction} ? ('-t', $args{transaction}) : ()), ); my $rootchanged = 0; for (my $i=0; $i<@dirschanged; ++$i) { if ($dirschanged[$i] eq '/') { $rootchanged = 1; } else { $dirschanged[$i] =~ s#^(.+)[/\\]$#$1#; } } return ($rootchanged,\@dirschanged); } sub fileschanged { my $self = shift; my %args; if ($#_ == 0) { $args{revision} = shift; } else { %args = @_; } # Figure out what files have changed using svnlook. my @svnlooklines = _read_from_process( $self->{cmd}, 'changed', $self->{repo}, ($args{revision} ? ('-r', $args{revision}) : ()), ($args{transaction} ? ('-t', $args{transaction}) : ()), ); # Parse the changed nodes. my @adds; my @dels; my @mods; foreach my $line (@svnlooklines) { my $path = ''; my $code = ''; # Split the line up into the modification code and path, ignoring # property modifications. if ($line =~ /^(.). (.*)$/) { $code = $1; $path = $2; } if ($code eq 'A') { push(@adds, $path); } elsif ($code eq 'D') { push(@dels, $path); } else { push(@mods, $path); } } return (\@adds,\@dels,\@mods); } sub diff { my $self = shift; my %args; if ($#_ == 0) { $args{revision} = shift; } else { %args = @_; } my @difflines = _read_from_process( $self->{cmd}, 'diff', $self->{repo}, ($args{revision} ? ('-r', $args{revision}) : ()), ($args{transaction} ? ('-t', $args{transaction}) : ()), ('--no-diff-deleted') ); # Ok we need to split this out now , by file my @lin = split(/Modified: (.*)\n=*\n/,join("\n",@difflines)); shift(@lin); my %lines = @lin; return %lines; } # # PRIVATE METHODS # Methods taken from commit-email.pl Copyright subversion team # # NB. croak is not a defined subroutine - where did this come from? # croak is defined in Carp, somehow didnt get included in CPAN post sub _read_from_process { unless (@_) { cluck("$0: read_from_process passed no arguments.\n"); } my ($status, @output) = _safe_read_from_pipe(@_); if ($status) { cluck("$0: `@_' failed with this output:", @output); } else { return @output; } } sub _safe_read_from_pipe { unless (@_) { croak("$0: safe_read_from_pipe passed no arguments.\n"); } my $pid = open(SAFE_READ, '-|'); unless (defined $pid) { die "$0: cannot fork: $!\n"; } unless ($pid) { open(STDERR, ">&STDOUT") or die "$0: cannot dup STDOUT: $!\n"; exec(@_)or die "$0: cannot exec `@_': $!\n"; } my @output; while () { s/[\r\n]+$//; push(@output, $_); } close(SAFE_READ); my $result = $?; my $exit = $result >> 8; my $signal = $result & 127; my $cd = $result & 128 ? "with core dump" : ""; if ($signal or $cd) { warn "$0: pipe from `@_' failed $cd: exit=$exit signal=$signal\n"; } if (wantarray) { return ($result, @output); } else { return $result; } } 1; __END__ =head1 AUTHOR Salvatore E ScottoDiLuzio, Contributions by Kevin Semande =head1 COPYRIGHT Copyright 2005 Salvatore E. ScottoDiLuzio. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut SVN-SVNLook-0.04/Makefile.PL0000444€fóè€m™òn0000000211510661354427022375 0ustar sscottoABAOFFICE\domain users00000000000000# Note: this file was auto-generated by Module::Build::Compat version 0.03 unless (eval "use Module::Build::Compat 0.02; 1" ) { print "This module requires Module::Build to install itself.\n"; require ExtUtils::MakeMaker; my $yn = ExtUtils::MakeMaker::prompt (' Install Module::Build now from CPAN?', 'y'); unless ($yn =~ /^y/i) { die " *** Cannot install without Module::Build. Exiting ...\n"; } require Cwd; require File::Spec; require CPAN; # Save this 'cause CPAN will chdir all over the place. my $cwd = Cwd::cwd(); CPAN::Shell->install('Module::Build::Compat'); CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate or die "Couldn't install Module::Build, giving up.\n"; chdir $cwd or die "Cannot chdir() back to $cwd: $!"; } eval "use Module::Build::Compat 0.02; 1" or die $@; Module::Build::Compat->run_build_pl(args => \@ARGV); require Module::Build; Module::Build::Compat->write_makefile(build_class => 'Module::Build'); SVN-SVNLook-0.04/MANIFEST0000444€fóè€m™òn0000000014110661354427021551 0ustar sscottoABAOFFICE\domain users00000000000000Changes Makefile.PL MANIFEST README META.yml Build.PL t/SVN-SVNLook.t lib/SVN/SVNLook.pm SVN-SVNLook-0.04/META.yml0000444€fóè€m™òn0000000065610661354427021704 0ustar sscottoABAOFFICE\domain users00000000000000--- name: SVN-SVNLook version: 0.04 author: - 'Salvatore E. ScottoDiLuzio sal.scotto@gmail.com' abstract: Module to aid in creating subversion hooks license: perl generated_by: Module::Build version 0.2808 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.2.html version: 1.2 provides: SVN::SVNLook: file: lib/SVN/SVNLook.pm version: 0.04 resources: license: http://dev.perl.org/licenses/ SVN-SVNLook-0.04/README0000444€fóè€m™òn0000000227610661354427021313 0ustar sscottoABAOFFICE\domain users00000000000000SVN-SVNLook version 0.04 ======================== The README is used to introduce the module and provide instructions on how to install the module, any machine dependencies it may have (for example C compilers and installed libraries) and any other information that should be provided before the module is installed. A README file is required for CPAN modules since CPAN extracts the README file from a module distribution so that people browsing the archive can use it get an idea of the modules uses. It is usually a good idea to provide version information here so that people can decide whether fixes for the module are worth downloading. INSTALLATION To install this module type the following: perl Makefile.PL make make test make install DEPENDENCIES This module requires these other modules and libraries: blah blah blah COPYRIGHT AND LICENCE Put the correct copyright and licence information here. Copyright (C) 2004 by A. U. Thor This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available. SVN-SVNLook-0.04/t/0000755€fóè€m™òn0000000000010661354427020671 5ustar sscottoABAOFFICE\domain users00000000000000SVN-SVNLook-0.04/t/SVN-SVNLook.t0000444€fóè€m™òn0000000075010661354427023015 0ustar sscottoABAOFFICE\domain users00000000000000# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl SVN-SVNLook.t' ######################### # change 'tests => 1' to 'tests => last_test_to_print'; use Test::More tests => 1; BEGIN { use_ok('SVN::SVNLook') }; ######################### # Insert your test code below, the Test::More module is use()ed here so read # its man page ( perldoc Test::More ) for help writing this test script.