Support :ext: access method.

This commit is contained in:
Sven Verdoolaege 2005-07-03 13:02:06 +02:00
parent 8d0ea31175
commit 34155390a5
2 changed files with 23 additions and 3 deletions

View File

@ -26,7 +26,8 @@ OPTIONS
------- -------
-d <CVSROOT>:: -d <CVSROOT>::
The root of the CVS archive. May be local (a simple path) or remote; 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>:: -o <branch-for-HEAD>::
The 'HEAD' branch from CVS is imported to the 'origin' branch within The 'HEAD' branch from CVS is imported to the 'origin' branch within

View File

@ -143,13 +143,32 @@ sub conn {
} }
$self->{'socketo'} = $s; $self->{'socketo'} = $s;
$self->{'socketi'} = $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 $pr = IO::Pipe->new();
my $pw = IO::Pipe->new(); my $pw = IO::Pipe->new();
my $pid = fork(); my $pid = fork();
die "Fork: $!\n" unless defined $pid; die "Fork: $!\n" unless defined $pid;
my $cvs = 'cvs'; my $cvs = 'cvs';
$cvs = $ENV{CVS_SERVER} if exists $ENV{CVS_SERVER}; $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) { unless($pid) {
$pr->writer(); $pr->writer();
$pw->reader(); $pw->reader();
@ -157,7 +176,7 @@ sub conn {
dup2($pr->fileno(),1); dup2($pr->fileno(),1);
$pr->close(); $pr->close();
$pw->close(); $pw->close();
exec($cvs,"server"); exec(@cvs);
} }
$pw->writer(); $pw->writer();
$pr->reader(); $pr->reader();