summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Langhoff <martin@catalyst.net.nz>2006-06-11 08:12:20 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-06-17 05:45:11 (GMT)
commit2f57c69792146e6c178a05edec18ab15d0138ad6 (patch)
tree88350e6446747bb463476cbe4c6ed4ee4ce72594
parent71b08148366bbc4d02b3477e7ded35b049206f89 (diff)
downloadgit-2f57c69792146e6c178a05edec18ab15d0138ad6.zip
git-2f57c69792146e6c178a05edec18ab15d0138ad6.tar.gz
git-2f57c69792146e6c178a05edec18ab15d0138ad6.tar.bz2
cvsimport: complete the cvsps run before starting the import
We now capture the output of cvsps to a tempfile, and then read it in. cvsps 2.1 works quite a bit "in memory", and only prints its patchset info once it has finished talking with cvs, but apparently retaining all that memory allocation. With this patch, cvsps is finished and reaped before cvsimport start working (and growing). So the footprint of the whole process is much lower. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rwxr-xr-xgit-cvsimport.perl42
1 files changed, 28 insertions, 14 deletions
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index d83c52f..9f5031a 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -529,25 +529,39 @@ if ($opt_A) {
write_author_info("$git_dir/cvs-authors");
}
-my $pid = open(CVS,"-|");
-die "Cannot fork: $!\n" unless defined $pid;
-unless($pid) {
- my @opt;
- @opt = split(/,/,$opt_p) if defined $opt_p;
- unshift @opt, '-z', $opt_z if defined $opt_z;
- unshift @opt, '-q' unless defined $opt_v;
- unless (defined($opt_p) && $opt_p =~ m/--no-cvs-direct/) {
- push @opt, '--cvs-direct';
+
+#
+# run cvsps into a file unless we are getting
+# it passed as a file via $opt_P
+#
+unless ($opt_P) {
+ print "Running cvsps...\n" if $opt_v;
+ my $pid = open(CVSPS,"-|");
+ die "Cannot fork: $!\n" unless defined $pid;
+ unless($pid) {
+ my @opt;
+ @opt = split(/,/,$opt_p) if defined $opt_p;
+ unshift @opt, '-z', $opt_z if defined $opt_z;
+ unshift @opt, '-q' unless defined $opt_v;
+ unless (defined($opt_p) && $opt_p =~ m/--no-cvs-direct/) {
+ push @opt, '--cvs-direct';
+ }
+ exec("cvsps","--norc",@opt,"-u","-A",'--root',$opt_d,$cvs_tree);
+ die "Could not start cvsps: $!\n";
}
- if ($opt_P) {
- exec("cat", $opt_P);
- } else {
- exec("cvsps","--norc",@opt,"-u","-A",'--root',$opt_d,$cvs_tree);
- die "Could not start cvsps: $!\n";
+ my ($cvspsfh, $cvspsfile) = tempfile('gitXXXXXX', SUFFIX => '.cvsps',
+ DIR => File::Spec->tmpdir());
+ while (<CVSPS>) {
+ print $cvspsfh $_;
}
+ close CVSPS;
+ close $cvspsfh;
+ $opt_P = $cvspsfile;
}
+open(CVS, "<$opt_P") or die $!;
+
## cvsps output:
#---------------------
#PatchSet 314