Author: paultcochrane
Date: Thu Mar 15 10:47:15 2007
New Revision: 17490
Modified:
trunk/t/codingstd/line_endings.t
Log:
[t] Removed usage of SVN::Client. This had the side effect of greatly
simplifying the code, and removing multiple checks on svk.
Also corrected and error in the pod.
Modified: trunk/t/codingstd/line_endings.t
==============================================================================
--- trunk/t/codingstd/line_endings.t (original)
+++ trunk/t/codingstd/line_endings.t Thu Mar 15 10:47:15 2007
@@ -9,34 +9,7 @@
use Test::More;
use ExtUtils::Manifest qw(maniread);
-# skip the tests if SVN::Client isn't installed
-BEGIN {
- eval { require SVN::Client; };
- if ($@) {
- plan skip_all => 'SVN::Client not installed';
- }
- eval {
- require SVK;
- require SVK::XD;
- require SVK::Util;
- };
- if ($@) {
- warn "SVK not installed\n";
- }
-}
-
-# are we using svk?
-my $use_svk = 0;
-our ( $svk, $output );
-{
- eval {
- my $client = SVN::Client->new();
- my $prop_ref = $client->propget( "svn:mime-type", "MANIFEST",
"WORKING", 0 );
- };
- if ($@) {
- $use_svk = is_svk_working_dir();
- }
-}
+my $cmd = -d '.svn' ? 'svn' : 'svk';
# set up how many tests to run
plan tests => 1;
@@ -56,7 +29,7 @@
=head1 DESCRIPTION
Checks that text files do not have DOS (CRLF) line endings. Instead, they
-should have Unix (CR) line endings.
+should have Unix (LF) line endings.
=head1 SEE ALSO
@@ -84,12 +57,12 @@
}
ok( !scalar(@dos_files), 'Line endings correct' )
- or diag( "DOS line ending found in " . scalar @dos_files . " files:[EMAIL
PROTECTED]" );
+ or diag( "DOS line ending found in " . scalar @dos_files .
+ " files:[EMAIL PROTECTED]" );
exit;
sub source_files {
- my $client = SVN::Client->new();
my $manifest = maniread('MANIFEST');
my @test_files;
@@ -97,24 +70,7 @@
foreach my $filename ( sort keys %$manifest ) {
# try to read the svn:mime-type property of the file
- my $prop;
-
- # using svk if available
- if ($use_svk) {
- my @svk_cmd_args = ( 'svn:mime-type', $filename );
- my $ret_val = $svk->propget(@svk_cmd_args);
- if ( $ret_val != 0 ) {
- die "Unable to run 'svk propget' command\n";
- }
- chomp $output;
- $prop = $output;
- }
-
- # or using svn
- else {
- my $prop_ref = $client->propget( "svn:mime-type", $filename,
"WORKING", 0 );
- $prop = $prop_ref->{$filename};
- }
+ my $prop = qx($cmd propget svn:mime-type $filename);
# if we have no mime-type property set or the mime-type is text/*
# then the file is text (this is the assumption used by subversion)
@@ -124,7 +80,6 @@
push @test_files, $filename;
}
else {
-
# if we know we have a text file, append it
push @test_files, $filename
if ( $prop =~ m{text} );
@@ -134,33 +89,6 @@
return @test_files;
}
-sub is_svk_working_dir {
-
- # set up svk so that we can use it
- my $svkpath = $ENV{SVKROOT} || SVK::Util::catfile( $ENV{HOME}, ".svk" );
- my $xd = SVK::XD->new(
- giantlock => SVK::Util::catfile( $svkpath, 'lock' ),
- statefile => SVK::Util::catfile( $svkpath, 'config' ),
- svkpath => $svkpath,
- );
-
- $xd->load();
-
- unless ( $ENV{SVKNOSVNCONFIG} ) {
- SVN::Core::config_ensure(undef);
- $xd->{svnconfig} = SVN::Core::config_get_config(undef);
- }
-
- $svk = SVK->new( xd => $xd, output => \$output );
-
- # we know that the MANIFEST should be there, so let's make sure we can
- # run the svk command
- my @svk_cmd_args = qw( svn:mime-type MANIFEST );
- my $ret_val = $svk->propget(@svk_cmd_args);
-
- return !$ret_val;
-}
-
# Local Variables:
# mode: cperl
# cperl-indent-level: 4