[svk-commit] r2912 - in branches/mirror-boostrap/lib/SVK: Command
nobody at bestpractical.com
nobody at bestpractical.com
Tue Jun 10 13:08:42 EDT 2008
Author: clkao
Date: Tue Jun 10 13:08:40 2008
New Revision: 2912
Modified:
branches/mirror-boostrap/lib/SVK/Command/Mirror.pm
branches/mirror-boostrap/lib/SVK/Mirror.pm
Log:
allow bootstrap from -.
Modified: branches/mirror-boostrap/lib/SVK/Command/Mirror.pm
==============================================================================
--- branches/mirror-boostrap/lib/SVK/Command/Mirror.pm (original)
+++ branches/mirror-boostrap/lib/SVK/Command/Mirror.pm Tue Jun 10 13:08:40 2008
@@ -218,7 +218,7 @@
}
die loc("No such dump file: %1.\n", $self->{bootstrap})
- unless -f ($self->{bootstrap});
+ unless $self->{bootstrap} eq '-' || -f ($self->{bootstrap});
$logger->info( loc("Bootstrapping mirror from dump") );
$m->bootstrap($self->{bootstrap}, $hint); # load from dumpfile
Modified: branches/mirror-boostrap/lib/SVK/Mirror.pm
==============================================================================
--- branches/mirror-boostrap/lib/SVK/Mirror.pm (original)
+++ branches/mirror-boostrap/lib/SVK/Mirror.pm Tue Jun 10 13:08:40 2008
@@ -239,15 +239,22 @@
sub bootstrap {
my ($self, $dumpfile, $file_hint) = @_;
$file_hint ||= $dumpfile;
- # XXX make these all 'require' not 'use' and fail optionally
+ my $fh;
# XXX requires unreleased SVN::Dump that removes binmode() in ::reader
# for compressed streams to work
- use SVN::Dump;
- use PerlIO::via::Bzip2;
- use PerlIO::gzip;
- open my $fh, '<', $dumpfile or die $!;
- binmode($fh, ':via(Bzip2)') if $file_hint =~ m/bz2/i;
- binmode($fh, ':gzip') if $file_hint =~ m/gz/i;
+ require SVN::Dump;
+ # XXX make these fail optionally
+ require PerlIO::via::Bzip2;
+ require PerlIO::gzip;
+
+ if ($dumpfile eq '-') {
+ $fh = \*STDIN;
+ }
+ else {
+ open $fh, '<', $dumpfile or die $!;
+ }
+ binmode($fh, ':via(Bzip2)') if $file_hint =~ m/bz2$/i;
+ binmode($fh, ':gzip(lazy)') if $file_hint =~ m/gz$/i;
my $dump = SVN::Dump->new( { fh => $fh } );
my $prefix = $self->path.'/';
More information about the svk-commit
mailing list