git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arkadiusz Miskiewicz <arekm@pld-linux.org>
To: git@vger.kernel.org
Subject: [PATCH not ready]: allow cvsimport to use compression when talking to remote cvs server
Date: Sat, 02 Aug 2008 16:05:58 +0200	[thread overview]
Message-ID: <g71pk6$eki$1@ger.gmane.org> (raw)


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/

                 reply	other threads:[~2008-08-02 14:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='g71pk6$eki$1@ger.gmane.org' \
    --to=arekm@pld-linux.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).