[PATCH] git-cvsimport-script: Support :ext: access method.

From: Sven Verdoolaege <skimo@kotnet.org>
Date: 2005-07-03 21:38:30
Support :ext: access method.

---
commit 34155390a576d8124e0adc864aaf2f11bbf5168b
tree 4918235816314f1d9981456cb05e395b6030c035
parent 8d0ea3117597933610e02907d14b443f8996ca3b
author Sven Verdoolaege <skimo@kotnet.org> Sun, 03 Jul 2005 13:02:06 +0200
committer Sven Verdoolaege <skimo@kotnet.org> Sun, 03 Jul 2005 13:02:06 +0200

 Documentation/git-cvsimport-script.txt |    3 ++-
 git-cvsimport-script                   |   23 +++++++++++++++++++++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-cvsimport-script.txt b/Documentation/git-cvsimport-script.txt
--- a/Documentation/git-cvsimport-script.txt
+++ b/Documentation/git-cvsimport-script.txt
@@ -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
diff --git a/git-cvsimport-script b/git-cvsimport-script
--- a/git-cvsimport-script
+++ b/git-cvsimport-script
@@ -143,13 +143,32 @@ 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();
@@ -157,7 +176,7 @@ sub conn {
 			dup2($pr->fileno(),1);
 			$pr->close();
 			$pw->close();
-			exec($cvs,"server");
+			exec(@cvs);
 		}
 		$pw->writer();
 		$pr->reader();
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Sat Jul 09 18:26:11 2005

This archive was generated by hypermail 2.1.8 : 2005-07-09 18:26:12 EST