Skip to content

Commit

Permalink
Support :ext: access method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Verdoolaege committed Jul 3, 2005
1 parent 8d0ea31 commit 3415539
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Documentation/git-cvsimport-script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ OPTIONS
-------
-d <CVSROOT>::
The root of the CVS archive. May be local (a simple path) or remote;
currently, only the :pserver: access method is supported.
currently, only the :local:, :ext: and :pserver: access methods
are supported.

-o <branch-for-HEAD>::
The 'HEAD' branch from CVS is imported to the 'origin' branch within
Expand Down
23 changes: 21 additions & 2 deletions git-cvsimport-script
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,40 @@ sub conn {
}
$self->{'socketo'} = $s;
$self->{'socketi'} = $s;
} else { # local: Fork off our own cvs server.
} else { # local or ext: Fork off our own cvs server.
my $pr = IO::Pipe->new();
my $pw = IO::Pipe->new();
my $pid = fork();
die "Fork: $!\n" unless defined $pid;
my $cvs = 'cvs';
$cvs = $ENV{CVS_SERVER} if exists $ENV{CVS_SERVER};
my $rsh = 'rsh';
$rsh = $ENV{CVS_RSH} if exists $ENV{CVS_RSH};

my @cvs = ($cvs, 'server');
my ($local, $user, $host);
$local = $repo =~ s/:local://;
if (!$local) {
$repo =~ s/:ext://;
$local = !($repo =~ s/^(?:([^\@:]+)\@)?([^:]+)://);
($user, $host) = ($1, $2);
}
if (!$local) {
if ($user) {
unshift @cvs, $rsh, '-l', $user, $host;
} else {
unshift @cvs, $rsh, $host;
}
}

unless($pid) {
$pr->writer();
$pw->reader();
dup2($pw->fileno(),0);
dup2($pr->fileno(),1);
$pr->close();
$pw->close();
exec($cvs,"server");
exec(@cvs);
}
$pw->writer();
$pr->reader();
Expand Down

0 comments on commit 3415539

Please sign in to comment.