r22192 - in /branches/upstream/libsvn-svnlook-perl: ./ current/ current/lib/ current/lib/SVN/ current/t/
myon at users.alioth.debian.org
myon at users.alioth.debian.org
Thu Jun 26 13:06:47 UTC 2008
Author: myon
Date: Thu Jun 26 13:06:46 2008
New Revision: 22192
URL: http://svn.debian.org/wsvn/?sc=1&rev=22192
Log:
[svn-inject] Installing original source of libsvn-svnlook-perl
Added:
branches/upstream/libsvn-svnlook-perl/
branches/upstream/libsvn-svnlook-perl/current/
branches/upstream/libsvn-svnlook-perl/current/Build.PL
branches/upstream/libsvn-svnlook-perl/current/Changes
branches/upstream/libsvn-svnlook-perl/current/MANIFEST
branches/upstream/libsvn-svnlook-perl/current/META.yml
branches/upstream/libsvn-svnlook-perl/current/Makefile.PL
branches/upstream/libsvn-svnlook-perl/current/README
branches/upstream/libsvn-svnlook-perl/current/lib/
branches/upstream/libsvn-svnlook-perl/current/lib/SVN/
branches/upstream/libsvn-svnlook-perl/current/lib/SVN/SVNLook.pm
branches/upstream/libsvn-svnlook-perl/current/t/
branches/upstream/libsvn-svnlook-perl/current/t/SVN-SVNLook.t
Added: branches/upstream/libsvn-svnlook-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libsvn-svnlook-perl/current/Build.PL?rev=22192&op=file
==============================================================================
--- branches/upstream/libsvn-svnlook-perl/current/Build.PL (added)
+++ branches/upstream/libsvn-svnlook-perl/current/Build.PL Thu Jun 26 13:06:46 2008
@@ -1,0 +1,11 @@
+use Module::Build;
+my $build = Module::Build->new
+(
+
+module_name => 'SVN::SVNLook',
+license => 'perl',
+create_makefile_pl => 'passthrough',
+dist_author => 'Salvatore E. ScottoDiLuzio <lt>sal.scotto at gmail.com<gt>',
+dist_abstract => 'Module to aid in creating subversion hooks'
+);
+$build->create_build_script;
Added: branches/upstream/libsvn-svnlook-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libsvn-svnlook-perl/current/Changes?rev=22192&op=file
==============================================================================
--- branches/upstream/libsvn-svnlook-perl/current/Changes (added)
+++ branches/upstream/libsvn-svnlook-perl/current/Changes Thu Jun 26 13:06:46 2008
@@ -1,0 +1,10 @@
+Revision 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
Added: branches/upstream/libsvn-svnlook-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libsvn-svnlook-perl/current/MANIFEST?rev=22192&op=file
==============================================================================
--- branches/upstream/libsvn-svnlook-perl/current/MANIFEST (added)
+++ branches/upstream/libsvn-svnlook-perl/current/MANIFEST Thu Jun 26 13:06:46 2008
@@ -1,0 +1,8 @@
+Changes
+Makefile.PL
+MANIFEST
+README
+META.yml
+Build.PL
+t/SVN-SVNLook.t
+lib/SVN/SVNLook.pm
Added: branches/upstream/libsvn-svnlook-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libsvn-svnlook-perl/current/META.yml?rev=22192&op=file
==============================================================================
--- branches/upstream/libsvn-svnlook-perl/current/META.yml (added)
+++ branches/upstream/libsvn-svnlook-perl/current/META.yml Thu Jun 26 13:06:46 2008
@@ -1,0 +1,17 @@
+---
+name: SVN-SVNLook
+version: 0.04
+author:
+ - 'Salvatore E. ScottoDiLuzio <lt>sal.scotto at gmail.com<gt>'
+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/
Added: branches/upstream/libsvn-svnlook-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libsvn-svnlook-perl/current/Makefile.PL?rev=22192&op=file
==============================================================================
--- branches/upstream/libsvn-svnlook-perl/current/Makefile.PL (added)
+++ branches/upstream/libsvn-svnlook-perl/current/Makefile.PL Thu Jun 26 13:06:46 2008
@@ -1,0 +1,31 @@
+# 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');
Added: branches/upstream/libsvn-svnlook-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libsvn-svnlook-perl/current/README?rev=22192&op=file
==============================================================================
--- branches/upstream/libsvn-svnlook-perl/current/README (added)
+++ branches/upstream/libsvn-svnlook-perl/current/README Thu Jun 26 13:06:46 2008
@@ -1,0 +1,40 @@
+SVN-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.
+
+
Added: branches/upstream/libsvn-svnlook-perl/current/lib/SVN/SVNLook.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libsvn-svnlook-perl/current/lib/SVN/SVNLook.pm?rev=22192&op=file
==============================================================================
--- branches/upstream/libsvn-svnlook-perl/current/lib/SVN/SVNLook.pm (added)
+++ branches/upstream/libsvn-svnlook-perl/current/lib/SVN/SVNLook.pm Thu Jun 26 13:06:46 2008
@@ -1,0 +1,351 @@
+package 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('', at 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", at 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 (<SAFE_READ>)
+ {
+ 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, <sal.scotto at gmail.com>
+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
Added: branches/upstream/libsvn-svnlook-perl/current/t/SVN-SVNLook.t
URL: http://svn.debian.org/wsvn/branches/upstream/libsvn-svnlook-perl/current/t/SVN-SVNLook.t?rev=22192&op=file
==============================================================================
--- branches/upstream/libsvn-svnlook-perl/current/t/SVN-SVNLook.t (added)
+++ branches/upstream/libsvn-svnlook-perl/current/t/SVN-SVNLook.t Thu Jun 26 13:06:46 2008
@@ -1,0 +1,15 @@
+# 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.
+
More information about the Pkg-perl-cvs-commits
mailing list