* [PATCH not ready]: allow cvsimport to use compression when talking to remote cvs server
@ 2008-08-02 14:05 Arkadiusz Miskiewicz
0 siblings, 0 replies; only message in thread
From: Arkadiusz Miskiewicz @ 2008-08-02 14:05 UTC (permalink / raw)
To: git
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/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-08-02 14:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-02 14:05 [PATCH not ready]: allow cvsimport to use compression when talking to remote cvs server Arkadiusz Miskiewicz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.