This patch adds ability to git cvsimport use compression when talking to remote cvs pserver (in normal cvs client using compression makes things a lot faster so it should help here, too). Unfortunately it doesn't work due to: new IO::Uncompress::RawInflate() hanging at constructor. No idea why constructor wants to do read() over a socket. Maybe whole IO::Compress stuff isn't ready to work over sockets (that's the question to perl gurus). Fell free to make it working/improve it. I have no idea how to make it work at this moment. --- git-cvsimport.org 2008-08-02 12:00:25.342934972 +0200 +++ git-cvsimport 2008-08-02 16:01:33.588363079 +0200 @@ -27,6 +27,15 @@ use POSIX qw(strftime dup2 ENOENT); use IPC::Open2; +my $compress_support = 1; +eval "use IO::Compress::RawDeflate; use IO::Uncompress::RawInflate"; +$compress_support = 0 if ($@); +if ($compress_support) { + use IO::Compress::RawDeflate; + use IO::Uncompress::RawInflate; +} + + $SIG{'PIPE'}="IGNORE"; $ENV{'TZ'}="UTC"; @@ -312,7 +321,9 @@ my @cvs = ($cvs, 'server'); my ($local, $user, $host); $local = $repo =~ s/:local://; - if (!$local) { + if ($local) { + $compress_support = 0; + } else { $repo =~ s/:ext://; $local = !($repo =~ s/^(?:([^\@:]+)\@)?([^:]+)://); ($user, $host) = ($1, $2); @@ -356,6 +367,12 @@ die "validReply: $res\n" if $res ne "ok"; $self->{'socketo'}->write("UseUnchanged\n") if $rep =~ /\bUseUnchanged\b/; + if ($compress_support and $rep =~ /\bGzip-stream\b/) { + my $level = 3; # make it cmd line option + $self->{'socketo'}->write("Gzip-stream $level\n"); + $self->{'socketo'} = new IO::Compress::RawDeflate $self->{'socketo'}, Level => $level or die("Setting up gzip compression failed: $IO::Compress::RawDeflate::RawDeflateError\n"); + $self->{'socketi'} = new IO::Uncompress::RawInflate $self->{'socketi'}, Transparent => 0 or die("Setting up gzip uncompression failed: $IO::Uncompress::RawInflate::RawInflateError\n"); + } $self->{'repo'} = $repo; } -- Arkadiusz Miśkiewicz PLD/Linux Team arekm / maven.pl http://ftp.pld-linux.org/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html