Subject: | Tests break on Win32 if working directory contains spaces |
When the current directory contains spaces, the URI's constructed in the
test files do not properly escape the spaces and SVN::Mirror and/or SVN
complain.
To fix this, use URI::file->new_abs() instead of File::Spec and
subsequent manipulations.
See attached patch for an example.
Subject: | SVN-Mirror-rev398-add-uri-file.patch |
Index: t/8skipto-torev.t
===================================================================
--- t/8skipto-torev.t (revision 398)
+++ t/8skipto-torev.t (working copy)
@@ -4,7 +4,7 @@
use Test::More;
use SVN::Mirror;
use File::Path;
-use File::Spec;
+use URI::file;
use strict;
plan skip_all => "can't find svnadmin"
@@ -23,9 +23,7 @@
{'fs-type' => $ENV{SVNFSTYPE}})
or die "failed to create repository at $repospath";
- my $uri = File::Spec->rel2abs( $repospath ) ;
- $uri =~ s{^|\\}{/}g if ($^O eq 'MSWin32');
- $uri = "file://$uri";
+ my $uri = URI::file->new_abs( $repospath ) ;
`svn mkdir -m 'init' $uri/source`;
`svnadmin load --parent-dir source $repospath < t/test_repo.dump`;
Index: t/9overlapping.t
===================================================================
--- t/9overlapping.t (revision 398)
+++ t/9overlapping.t (working copy)
@@ -2,7 +2,7 @@
use Test::More;
use SVN::Mirror;
use File::Path;
-use File::Spec;
+use URI::file;
use strict;
plan skip_all => "can't find svnadmin"
@@ -18,9 +18,7 @@
{'fs-type' => $ENV{SVNFSTYPE}})
or die "failed to create repository at $repospath";
-my $uri = File::Spec->rel2abs( $repospath ) ;
-$uri =~ s{^|\\}{/}g if ($^O eq 'MSWin32');
-$uri = "file://$uri";
+my $uri = URI::file->new_abs( $repospath ) ;
`svn mkdir -m 'init' $uri/source`;
`svnadmin load --parent-dir source $repospath < t/test_repo.dump`;
Index: t/7copy.t
===================================================================
--- t/7copy.t (revision 398)
+++ t/7copy.t (working copy)
@@ -2,7 +2,7 @@
use Test::More;
use SVN::Mirror;
use File::Path;
-use File::Spec;
+use URI::file;
use strict;
plan skip_all => "can't find svnadmin"
@@ -18,9 +18,7 @@
{'fs-type' => $ENV{SVNFSTYPE}})
or die "failed to create repository at $repospath";
-my $uri = File::Spec->rel2abs( $repospath ) ;
-$uri =~ s{^|\\}{/}g if ($^O eq 'MSWin32');
-$uri = "file://$uri";
+my $uri = URI::file->new_abs( $repospath ) ;
`svn mkdir -m 'init' $uri/source`;
`svnadmin load --parent-dir source $repospath < t/copy.dump`;
Index: t/6relay.t
===================================================================
--- t/6relay.t (revision 398)
+++ t/6relay.t (working copy)
@@ -2,7 +2,7 @@
use Test::More;
use SVN::Mirror;
use File::Path;
-use File::Spec;
+use URI::file;
use strict;
plan skip_all => "relay doesn't work with svn < 1.1.0"
@@ -21,9 +21,7 @@
{'fs-type' => $ENV{SVNFSTYPE}})
or die "failed to create repository at $repospath";
-my $uri = File::Spec->rel2abs( $repospath ) ;
-$uri =~ s{^|\\}{/}g if ($^O eq 'MSWin32');
-$uri = "file://$uri";
+my $uri = URI::file->new_abs( $repospath ) ;
`svn mkdir -m 'init' $uri/source`;
`svnadmin load --parent-dir source $repospath < t/test_repo.dump`;
@@ -34,9 +32,7 @@
{'fs-type' => $ENV{SVNFSTYPE} || 'bdb'})
or die "failed to create repository at $rrepospath";
-my $ruri = File::Spec->rel2abs( $rrepospath ) ;
-$ruri =~ s{^|\\}{/}g if ($^O eq 'MSWin32');
-$ruri = "file://$ruri";
+my $ruri = URI::file->new_abs( $rrepospath ) ;
for (1..50) {
`svn mkdir -m 'waste-rev' $ruri/waste`;
Index: t/2basic.t
===================================================================
--- t/2basic.t (revision 398)
+++ t/2basic.t (working copy)
@@ -3,6 +3,7 @@
use SVN::Mirror;
use File::Path;
use File::Spec;
+use URI::file;
use strict;
plan skip_all => "can't find svnadmin"
@@ -18,9 +19,7 @@
{'fs-type' => $ENV{SVNFSTYPE}})
or die "failed to create repository at $repospath";
-my $uri = File::Spec->rel2abs( $repospath ) ;
-$uri =~ s{^|\\}{/}g if ($^O eq 'MSWin32');
-$uri = "file://$uri";
+my $uri = URI::file->new_abs( $repospath ) ;
`svn mkdir -m 'init' $uri/source`;
`svnadmin load --parent-dir source $repospath < t/test_repo.dump`;
Index: Makefile.PL
===================================================================
--- Makefile.PL (revision 398)
+++ Makefile.PL (working copy)
@@ -13,6 +13,7 @@
requires(
'SVN::Core' => $required_svn,
'URI::Escape' => '0',
+ 'URI::file' => '0',
'Term::ReadKey' => '0',
'SVN::Simple::Edit' => '0',
'Date::Format' => '0',