r26594 - in /branches/upstream/libsvn-look-perl: ./ current/ current/lib/ current/lib/SVN/ current/t/

angelabad-guest at users.alioth.debian.org angelabad-guest at users.alioth.debian.org
Mon Nov 3 11:50:17 UTC 2008


Author: angelabad-guest
Date: Mon Nov  3 11:50:10 2008
New Revision: 26594

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=26594
Log:
[svn-inject] Installing original source of libsvn-look-perl

Added:
    branches/upstream/libsvn-look-perl/
    branches/upstream/libsvn-look-perl/current/
    branches/upstream/libsvn-look-perl/current/.cvsignore
    branches/upstream/libsvn-look-perl/current/Changes
    branches/upstream/libsvn-look-perl/current/MANIFEST
    branches/upstream/libsvn-look-perl/current/META.yml
    branches/upstream/libsvn-look-perl/current/Makefile.PL
    branches/upstream/libsvn-look-perl/current/README
    branches/upstream/libsvn-look-perl/current/lib/
    branches/upstream/libsvn-look-perl/current/lib/SVN/
    branches/upstream/libsvn-look-perl/current/lib/SVN/Look.pm
    branches/upstream/libsvn-look-perl/current/t/
    branches/upstream/libsvn-look-perl/current/t/00-load.t
    branches/upstream/libsvn-look-perl/current/t/01-commands.t
    branches/upstream/libsvn-look-perl/current/t/pod-coverage.t   (with props)
    branches/upstream/libsvn-look-perl/current/t/pod.t   (with props)
    branches/upstream/libsvn-look-perl/current/t/test-functions.pl   (with props)

Added: branches/upstream/libsvn-look-perl/current/.cvsignore
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-look-perl/current/.cvsignore?rev=26594&op=file
==============================================================================
--- branches/upstream/libsvn-look-perl/current/.cvsignore (added)
+++ branches/upstream/libsvn-look-perl/current/.cvsignore Mon Nov  3 11:50:10 2008
@@ -1,0 +1,10 @@
+blib*
+Makefile
+Makefile.old
+Build
+_build*
+pm_to_blib*
+*.tar.gz
+.lwpcookies
+SVN-Look-*
+cover_db

Added: branches/upstream/libsvn-look-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-look-perl/current/Changes?rev=26594&op=file
==============================================================================
--- branches/upstream/libsvn-look-perl/current/Changes (added)
+++ branches/upstream/libsvn-look-perl/current/Changes Mon Nov  3 11:50:10 2008
@@ -1,0 +1,31 @@
+Revision history for SVN-Look. -*- text -*-
+
+0.12	2008-10-09
+
+	Removing dependency from SVN::Hooks from the tests.
+
+0.11	2008-10-04
+
+	Using File::Spec to be a little more portable.
+
+0.10	2008-09-27
+
+	Implemented the 'diff' method.
+
+0.09	2008-09-27
+	Removed dependency from Switch.pm.
+
+	Look for the svnlook command in a bunch of directories.
+
+	Now the module can be built without the svn commands but the
+	tests will check this and be skipped.
+
+	Added tests: t/pod.t and t/pod-coverage.t
+
+	Private functions got the _ prefix to avoid complaints from
+	pod-coverage.t. 
+
+0.08    2008-09-25/23:00:00
+        First version released independently of SVN::Hooks.
+
+

Added: branches/upstream/libsvn-look-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-look-perl/current/MANIFEST?rev=26594&op=file
==============================================================================
--- branches/upstream/libsvn-look-perl/current/MANIFEST (added)
+++ branches/upstream/libsvn-look-perl/current/MANIFEST Mon Nov  3 11:50:10 2008
@@ -1,0 +1,12 @@
+.cvsignore
+Changes
+lib/SVN/Look.pm
+Makefile.PL
+MANIFEST
+META.yml
+README
+t/00-load.t
+t/01-commands.t
+t/pod-coverage.t
+t/pod.t
+t/test-functions.pl

Added: branches/upstream/libsvn-look-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-look-perl/current/META.yml?rev=26594&op=file
==============================================================================
--- branches/upstream/libsvn-look-perl/current/META.yml (added)
+++ branches/upstream/libsvn-look-perl/current/META.yml Mon Nov  3 11:50:10 2008
@@ -1,0 +1,12 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         SVN-Look
+version:      0.12.442
+version_from: lib/SVN/Look.pm
+installdirs:  site
+requires:
+    File::Spec::Functions:         0
+    Test::More:                    0
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.30_01

Added: branches/upstream/libsvn-look-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-look-perl/current/Makefile.PL?rev=26594&op=file
==============================================================================
--- branches/upstream/libsvn-look-perl/current/Makefile.PL (added)
+++ branches/upstream/libsvn-look-perl/current/Makefile.PL Mon Nov  3 11:50:10 2008
@@ -1,0 +1,34 @@
+use strict;
+use warnings;
+use File::Spec::Functions qw/catfile path/;
+use ExtUtils::MakeMaker;
+
+my $svnlook;
+for my $d (
+    path(),
+    catfile('usr', 'local', 'bin'),
+    catfile('usr', 'bin'),
+    catfile('bin'),
+) {
+    my $f = catfile($d, 'svnlook');
+    if (-x $f) {
+	$svnlook = $f;
+	last;
+    }
+}
+die "Aborting because I couldn't find the 'svnlook' executable.\n"
+    unless $svnlook;
+
+WriteMakefile(
+    NAME                => 'SVN::Look',
+    AUTHOR              => 'Gustavo Chaves <gustavo+perl at gnustavo.org>',
+    VERSION_FROM        => 'lib/SVN/Look.pm',
+    ABSTRACT_FROM       => 'lib/SVN/Look.pm',
+    PL_FILES            => {},
+    PREREQ_PM => {
+        'Test::More'    => 0,
+	'File::Spec::Functions' => 0,
+    },
+    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+    clean               => { FILES => 'SVN-Look-*' },
+);

Added: branches/upstream/libsvn-look-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-look-perl/current/README?rev=26594&op=file
==============================================================================
--- branches/upstream/libsvn-look-perl/current/README (added)
+++ branches/upstream/libsvn-look-perl/current/README Mon Nov  3 11:50:10 2008
@@ -1,0 +1,53 @@
+Name:    SVN-Look
+What:    A caching wrapper aroung the svnlook command.
+Version: 0.12
+Author:  Gustavo Chaves <gnustavo at cpan.org>
+
+SVN-Look is a caching wrapper aroung the svnlook command.
+
+The svnlook command is the workhorse of Subversion hook scripts, being
+used to gather all sorts of information about a repository, its
+revisions, and its transactions. This script provides a simple object
+oriented interface to a specific svnlook invocation, to make it easier
+to hook writers to get and use the information they need. Moreover,
+all the information gathered buy calling the svnlook command is cached
+in the object, avoiding repetitious calls.
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+	perl Makefile.PL
+	make
+	make test
+	make install
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the
+perldoc command.
+
+    perldoc SVN::Look
+
+You can also look for information at:
+
+    RT, CPAN's request tracker
+        http://rt.cpan.org/NoAuth/Bugs.html?Dist=SVN-Look
+
+    AnnoCPAN, Annotated CPAN documentation
+        http://annocpan.org/dist/SVN-Look
+
+    CPAN Ratings
+        http://cpanratings.perl.org/d/SVN-Look
+
+    Search CPAN
+        http://search.cpan.org/dist/SVN-Look
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2008 CPqD (http://www.cpqd.com.br/)
+
+This program is free software; you can redistribute it and/or modify it
+under the GNU GPL v3 or newer.
+

Added: branches/upstream/libsvn-look-perl/current/lib/SVN/Look.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-look-perl/current/lib/SVN/Look.pm?rev=26594&op=file
==============================================================================
--- branches/upstream/libsvn-look-perl/current/lib/SVN/Look.pm (added)
+++ branches/upstream/libsvn-look-perl/current/lib/SVN/Look.pm Mon Nov  3 11:50:10 2008
@@ -1,0 +1,487 @@
+package SVN::Look;
+
+use warnings;
+use strict;
+use File::Spec::Functions qw/catfile path rootdir/;
+
+=head1 NAME
+
+SVN::Look - A caching wrapper aroung the svnlook command.
+
+=head1 VERSION
+
+Version 0.12
+
+=cut
+
+our $VERSION = '0.12.' . substr(q$Revision: 442 $, 10);
+
+=head1 SYNOPSIS
+
+  use SVN::Look;
+  my $revlook = SVN::Look->new('/repo/path', -r => 123);
+  my $author  = $revlook->author();
+  my $msg     = $revlook->log_msg();
+  my @added_files   = $revlook->added();
+  my @updated_files = $revlook->updated();
+  my @deleted_files = $revlook->deleted();
+  my @changed_files = $revlook->changed();
+  my $file_contents = $revlook->cat('/path/to/file/in/repository');
+
+  my $trxlook = SVN::Look->new('/repo/path', -t => 123);
+
+=head1 DESCRIPTION
+
+The svnlook command is the workhorse of Subversion hook scripts, being
+used to gather all sorts of information about a repository, its
+revisions, and its transactions. This script provides a simple object
+oriented interface to a specific svnlook invocation, to make it easier
+to hook writers to get and use the information they need. Moreover,
+all the information gathered buy calling the svnlook command is cached
+in the object, avoiding repetitious calls.
+
+=cut
+
+our $SVNLOOK;
+my $root = rootdir();
+for my $d (
+    path(),
+    catfile($root, 'usr', 'local', 'bin'),
+    catfile($root, 'usr', 'bin'),
+    catfile($root, 'bin'),
+) {
+    my $f = catfile($d, 'svnlook');
+    if (-x $f) {
+	$SVNLOOK = $f;
+	last;
+    }
+}
+die "Aborting because I couldn't find the svnlook executable.\n"
+    unless $SVNLOOK;
+
+=head1 METHODS
+
+=over 4
+
+=item B<new> REPO, WHAT, NUMBER
+
+The SVN::Look constructor needs three arguments:
+
+=over
+
+=item REPO is the path to the repository.
+
+=item WHAT must be either '-r' or '-t', specifying if the third
+argument is a revision number or a transaction number, respectivelly.
+
+=item NUMBER is either a revision or transaction NUMBER, as specified
+by WHAT.
+
+=back
+
+=cut
+
+sub new {
+    my ($class, $repo, $what, $txn_or_rev) = @_;
+    my $self = {
+	repo     => $repo,
+	what     => [$what, $txn_or_rev],
+	txn      => undef,
+	rev      => undef,
+	author   => undef,
+	log      => undef,
+	changed  => undef,
+	proplist => undef,
+    };
+    if ($what eq '-t') {
+	$self->{txn} = $txn_or_rev;
+    }
+    elsif ($what eq '-r') {
+	$self->{rev} = $txn_or_rev;
+    }
+    else {
+	die "Look::new: third argument must be -t or -r, not ($what)";
+    }
+    bless $self, $class;
+    return $self;
+}
+
+sub _svnlook {
+    my ($self, $cmd, @args) = @_;
+    open my $fd, '-|', $SVNLOOK, $cmd, $self->{repo}, @{$self->{what}}, @args
+	or die "Can't exec svnlook $cmd: $!\n";
+    if (wantarray) {
+	my @lines = <$fd>;
+	close $fd or die "Failed closing svnlook $cmd: $!\n";
+	chomp foreach @lines;
+	return @lines;
+    }
+    else {
+	local $/ = undef;
+	my $line = <$fd>;
+	close $fd or die "Failed closing svnlook $cmd: $!\n";
+	chomp $line;
+	return $line;
+    }
+}
+
+=item B<repo>
+
+Returns the repository path that was passed to the constructor.
+
+=cut
+
+sub repo {
+    my $self = shift;
+    return $self->{repo};
+}
+
+=item B<txn>
+
+Returns the transaction number that was passed to the constructor. If
+none was passed, returns undef.
+
+=cut
+
+sub txn {
+    my $self = shift;
+    return $self->{txn};
+}
+
+=item B<rev>
+
+Returns the revision number that was passed to the constructor. If
+none was passed, returns undef.
+
+=cut
+
+sub rev {
+    my $self = shift;
+    return $self->{rev};
+}
+
+=item B<author>
+
+Returns the author of the revision/transaction.
+
+=cut
+
+sub author {
+    my $self = shift;
+    unless ($self->{author}) {
+	chomp($self->{author} = $self->_svnlook('author'));
+    }
+    return $self->{author};
+}
+
+=item B<log_msg>
+
+Returns the log message of the revision/transaction.
+
+=cut
+
+sub log_msg {
+    my $self = shift;
+    unless ($self->{log}) {
+	$self->{log} = $self->_svnlook('log');
+    }
+    return $self->{log};
+}
+
+=item B<date>
+
+Returns the date of the revision/transaction.
+
+=cut
+
+sub date {
+    my $self = shift;
+    unless ($self->{date}) {
+	$self->{date} = ($self->_svnlook('info'))[1];
+    }
+    return $self->{date};
+}
+
+=item B<proplist> PATH
+
+Returns a reference to a hash containing the properties associated with PATH.
+
+=cut
+
+sub proplist {
+    my ($self, $path) = @_;
+    unless ($self->{proplist}{$path}) {
+	my $text = $self->_svnlook('proplist', '--verbose', $path);
+	my @list = split /^\s\s(\S+)\s:\s/m, $text;
+	shift @list;		# skip the leading empty field
+	chomp(my %hash = @list);
+	$self->{proplist}{$path} = \%hash;
+    }
+    return $self->{proplist}{$path};
+}
+
+=item B<changed_hash>
+
+Returns a reference to a hash containing information about all file
+changes occurred in the revision. The hash always has the following
+pairs:
+
+=over
+
+=item added
+
+A list of files added in the revision.
+
+=item deleted
+
+A list of files deleted in the revision.
+
+=item updated
+
+A list of files updated in the revision.
+
+=item prop_modified
+
+A list of files that had properties modified in the revision.
+
+=item copied
+
+A hash mapping the old to the new name of each file moved in the
+revision.
+
+=back
+
+=cut
+
+sub changed_hash {
+    my $self = shift;
+    unless ($self->{changed_hash}) {
+	my (@added, @deleted, @updated, @prop_modified, %copied);
+	foreach ($self->_svnlook('changed', '--copy-info')) {
+	    next if length($_) <= 4;
+	    chomp;
+	    my ($action, $prop, undef, undef, $changed) = unpack 'AAAA A*', $_;
+	    if    ($action eq 'A') {
+		push @added,   $changed;
+	    }
+	    elsif ($action eq 'D') {
+		push @deleted, $changed;
+	    }
+	    elsif ($action eq 'U') {
+		push @updated, $changed;
+	    }
+	    else {
+		if ($changed =~ /^\(from (.*?):r(\d+)\)$/) {
+		    $copied{$added[-1]} = [$1 => $2];
+		}
+	    }
+	    if ($prop eq 'U') {
+		push @prop_modified, $changed;
+	    }
+	}
+	$self->{changed_hash} = {
+	    added         => \@added,
+	    deleted       => \@deleted,
+	    updated       => \@updated,
+	    prop_modified => \@prop_modified,
+	    copied        => \%copied,
+	};
+    }
+    return $self->{changed_hash};
+}
+
+=item B<added>
+
+Returns the list of files added in the revision/transaction.
+
+=cut
+
+sub added {
+    my $self = shift;
+    return @{$self->changed_hash()->{added}};
+}
+
+=item B<updated>
+
+Returns the list of files updated in the revision/transaction.
+
+=cut
+
+sub updated {
+    my $self = shift;
+    return @{$self->changed_hash()->{updated}};
+}
+
+=item B<deleted>
+
+Returns the list of files deleted in the revision/transaction.
+
+=cut
+
+sub deleted {
+    my $self = shift;
+    return @{$self->changed_hash()->{deleted}};
+}
+
+=item B<prop_modified>
+
+Returns the list of files that had properties modified in the
+revision/transaction.
+
+=cut
+
+sub prop_modified {
+    my $self = shift;
+    return @{$self->changed_hash()->{prop_modified}};
+}
+
+=item B<changed>
+
+Returns the list of all files added, updated, deleted, and the ones
+that had properties modified in the revision/transaction.
+
+=cut
+
+sub changed {
+    my $self = shift;
+    my $hash = $self->changed_hash();
+    unless (exists $hash->{changed}) {
+	$hash->{changed} = [@{$hash->{added}}, @{$hash->{updated}}, @{$hash->{deleted}}, @{$hash->{prop_modified}}];
+    }
+    return @{$hash->{changed}};
+}
+
+=item B<dirs_changed>
+
+Returns the list of directories changed in the revision/transaction.
+
+=cut
+
+sub dirs_changed {
+    my $self = shift;
+    unless (exists $self->{dirs_changed}) {
+	my @dirs = $self->_svnlook('dirs-changed');
+	$self->{dirs_changed} = \@dirs;
+    }
+    return @{$self->{dirs_changed}};
+}
+
+=item B<copied_from>
+
+Returns the list of original names of files that were renamed in the
+revision/transaction.
+
+=cut
+
+sub copied_from {
+    my $self = shift;
+    return keys %{$self->changed_hash()->{copied_from}};
+}
+
+=item B<copied_to>
+
+Returns the list of new names of files that were renamed in the
+revision/transaction. The order of this list is guaranteed to agree
+with the order generated by the method copied_from.
+
+=cut
+
+sub copied_to {
+    my $self = shift;
+    return values %{$self->changed_hash()->{copied_from}};
+}
+
+=item B<cat> PATH
+
+Returns the contents of the file at PATH. In scalar context, return
+the whole contents in a single string. In list context returns a list
+of chomped lines.
+
+=cut
+
+sub cat {
+    my ($self, $path) = @_;
+    return $self->_svnlook('cat', $path);
+}
+
+=item B<diff> [OPTS, ...]
+
+Returns the GNU-style diffs of changed files and properties. There are
+three optional options that can be passed as strings:
+
+=over
+
+=item C<--no-diff-deleted>
+
+Do not print differences for deleted files
+
+=item C<--no-diff-added>
+
+Do not print differences for added files.
+
+=item C<--diff-copy-from>
+
+Print differences against the copy source.
+
+=back
+
+In scalar context, return the whole diff in a single string. In list
+context returns a list of chomped lines.
+
+=cut
+
+sub diff {
+    my ($self, @opts) = @_;
+    return $self->_svnlook('diff', @opts);
+}
+
+=back
+
+=head1 AUTHOR
+
+Gustavo Chaves, C<< <gnustavo at cpan.org> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to C<bug-svn-look at rt.cpan.org>, or through
+the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SVN-Hooks>.  I will be notified, and then you'll
+automatically be notified of progress on your bug as I make changes.
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+    perldoc SVN::Look
+
+You can also look for information at:
+
+=over 4
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=SVN-Hooks>
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/SVN-Hooks>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/SVN-Hooks>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/SVN-Hooks>
+
+=back
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2008 Gustavo Chaves, all rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+
+1; # End of SVN::Look

Added: branches/upstream/libsvn-look-perl/current/t/00-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-look-perl/current/t/00-load.t?rev=26594&op=file
==============================================================================
--- branches/upstream/libsvn-look-perl/current/t/00-load.t (added)
+++ branches/upstream/libsvn-look-perl/current/t/00-load.t Mon Nov  3 11:50:10 2008
@@ -1,0 +1,17 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use lib 't';
+use Test::More;
+
+require "test-functions.pl";
+
+if (has_svn()) {
+    plan tests => 1;
+}
+else {
+    plan skip_all => 'Need svn commands in the PATH.';
+}
+
+require_ok('SVN::Look');

Added: branches/upstream/libsvn-look-perl/current/t/01-commands.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-look-perl/current/t/01-commands.t?rev=26594&op=file
==============================================================================
--- branches/upstream/libsvn-look-perl/current/t/01-commands.t (added)
+++ branches/upstream/libsvn-look-perl/current/t/01-commands.t Mon Nov  3 11:50:10 2008
@@ -1,0 +1,61 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use lib 't';
+use SVN::Look;
+use Test::More;
+
+require "test-functions.pl";
+
+if (has_svn()) {
+    plan tests => 8;
+}
+else {
+    plan skip_all => 'Need svn commands in the PATH.';
+}
+
+my $t = reset_repo();
+
+system(<<"EOS");
+echo first >$t/wc/file
+svn add -q --no-auto-props $t/wc/file
+svn ps -q svn:mime-type text/plain $t/wc/file
+svn ci -q -mlog $t/wc/file
+EOS
+
+my $look = SVN::Look->new("$t/repo", -r => 1);
+
+ok(defined $look, 'constructor');
+
+cmp_ok($look->author(), 'eq', $ENV{USER}, 'author');
+
+cmp_ok($look->log_msg(), 'eq', "log\n", 'log_msg');
+
+cmp_ok(($look->added())[0], 'eq', 'file', 'added');
+
+system(<<"EOS");
+echo second >>$t/wc/file
+svn ci -q -mlog $t/wc/file
+EOS
+
+$look = SVN::Look->new("$t/repo", -r => 2);
+
+cmp_ok($look->diff(), '=~', qr/\+second/, 'diff');
+
+system(<<"EOS");
+echo space in name >$t/wc/'a b.txt'
+svn add -q --no-auto-props $t/wc/'a b.txt'
+svn ps -q svn:mime-type text/plain $t/wc/'a b.txt'
+svn ci -q -mlog $t/wc/'a b.txt'
+EOS
+
+$look = SVN::Look->new("$t/repo", -r => 3);
+
+my $pl = eval { $look->proplist('a b.txt') };
+
+ok(defined $pl, 'can call proplist in a file with spaces in the name');
+
+ok(exists $pl->{'svn:mime-type'}, 'proplist finds the expected property');
+
+is($pl->{'svn:mime-type'}, 'text/plain', 'proplist finds the correct property value');

Added: branches/upstream/libsvn-look-perl/current/t/pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-look-perl/current/t/pod-coverage.t?rev=26594&op=file
==============================================================================
--- branches/upstream/libsvn-look-perl/current/t/pod-coverage.t (added)
+++ branches/upstream/libsvn-look-perl/current/t/pod-coverage.t Mon Nov  3 11:50:10 2008
@@ -1,0 +1,20 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod::Coverage
+my $min_tpc = 1.08;
+eval "use Test::Pod::Coverage $min_tpc";
+plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
+    if $@;
+
+# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
+# but older versions don't recognize some common documentation styles
+my $min_pc = 0.18;
+eval "use Pod::Coverage $min_pc";
+plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
+    if $@;
+
+all_pod_coverage_ok();

Propchange: branches/upstream/libsvn-look-perl/current/t/pod-coverage.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libsvn-look-perl/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-look-perl/current/t/pod.t?rev=26594&op=file
==============================================================================
--- branches/upstream/libsvn-look-perl/current/t/pod.t (added)
+++ branches/upstream/libsvn-look-perl/current/t/pod.t Mon Nov  3 11:50:10 2008
@@ -1,0 +1,12 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod
+my $min_tp = 1.22;
+eval "use Test::Pod $min_tp";
+plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
+
+all_pod_files_ok();

Propchange: branches/upstream/libsvn-look-perl/current/t/pod.t
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libsvn-look-perl/current/t/test-functions.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libsvn-look-perl/current/t/test-functions.pl?rev=26594&op=file
==============================================================================
--- branches/upstream/libsvn-look-perl/current/t/test-functions.pl (added)
+++ branches/upstream/libsvn-look-perl/current/t/test-functions.pl Mon Nov  3 11:50:10 2008
@@ -1,0 +1,87 @@
+# Copyright (C) 2008 by CPqD
+
+BEGIN { $ENV{PATH} = '/usr/local/bin:/usr/bin:/bin' }
+
+use strict;
+use warnings;
+use Cwd;
+use File::Temp qw/tempdir/;
+use File::Spec::Functions qw/catfile path/;
+
+# Make sure the svn messages come in English.
+$ENV{LC_MESSAGES} = 'C';
+
+sub has_svn {
+  CMD:
+    for my $cmd (qw/svn svnadmin svnlook/) {
+	for my $path (path()) {
+	    next CMD if -x catfile($path, $cmd);
+	}
+	return 0;
+    }
+    return 1;
+}
+
+our $T;
+
+sub do_script {
+    my ($num, $cmd) = @_;
+    {
+	open my $script, '>', "$T/script" or die;
+	print $script $cmd;
+	close $script;
+	chmod 0755, "$T/script";
+    }
+
+    system("$T/script 1>$T/$num.stdout 2>$T/$num.stderr");
+}
+
+sub work_ok {
+    my ($tag, $cmd) = @_;
+    my $num = 1 + Test::Builder->new()->current_test();
+    ok((do_script($num, $cmd) == 0), $tag)
+	or diag("work_ok command failed.\n");
+}
+
+sub work_nok {
+    my ($tag, $error_expect, $cmd) = @_;
+
+    my $num = 1 + Test::Builder->new()->current_test();
+    my $exit = do_script($num, $cmd);
+    if ($exit == 0) {
+	fail($tag);
+	diag("work_nok command worked but it shouldn't!\n");
+	return;
+    }
+
+    my $stderr = `cat $T/$num.stderr`;
+
+    if (! ref $error_expect) {
+	ok(index($stderr, $error_expect) >= 0, $tag)
+	    or diag("work_nok:\n  '$stderr'\n    does not contain\n  '$error_expect'\n");
+    }
+    elsif (ref $error_expect eq 'Regexp') {
+	like($stderr, $error_expect, $tag);
+    }
+    else {
+	fail($tag);
+	diag("work_nok: invalid second argument to test.\n");
+    }
+}
+
+sub reset_repo {
+    my $cleanup = exists $ENV{REPO_CLEANUP} ? $ENV{REPO_CLEANUP} : 1;
+    $T = tempdir('t.XXXX', DIR => getcwd(), CLEANUP => $cleanup);
+
+    system(<<"EOS");
+svnadmin create $T/repo
+EOS
+
+    system(<<"EOS");
+svn co -q file://$T/repo $T/wc
+EOS
+
+    return $T;
+}
+
+1;

Propchange: branches/upstream/libsvn-look-perl/current/t/test-functions.pl
------------------------------------------------------------------------------
    svn:executable = 




More information about the Pkg-perl-cvs-commits mailing list