summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e7e477d)
raw | patch | inline | side by side (parent: e7e477d)
author | Matthias Urlichs <smurf@smurf.noris.de> | |
Mon, 10 Oct 2005 16:45:00 +0000 (18:45 +0200) | ||
committer | Matthias Urlichs <smurf@smurf.noris.de> | |
Mon, 10 Oct 2005 16:45:00 +0000 (18:45 +0200) |
The svn library has a serious memory leak.
Added a new option (-l NUM) which causes git-svnimport to exit cleanly
after fetching that many changes, in order to \1a.
Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de>
Added a new option (-l NUM) which causes git-svnimport to exit cleanly
after fetching that many changes, in order to \1a.
Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de>
Documentation/git-svnimport.txt | patch | blob | history | |
git-svnimport.perl | patch | blob | history |
index a144c6c31ca9131b00be1585a785ede53f87a731..047f8f334600253fefed5a8d6a5bc734d84f16f4 100644 (file)
SYNOPSIS
--------
'git-svnimport' [ -o <branch-for-HEAD> ] [ -h ] [ -v ]
- [ -C <GIT_repository> ] [ -i ] [ -u ]
+ [ -C <GIT_repository> ] [ -i ] [ -u ] [-l limit_nr_changes]
[ -b branch_subdir ] [ -t trunk_subdir ] [ -T tag_subdir ]
[ -s start_chg ] [ -m ] [ -M regex ] [ <SVN_repository_URL> ]
regex. It can be used with -m to also see the default regexes.
You must escape forward slashes.
+-l <max_num_changes>::
+ Limit the number of SVN changesets we pull before quitting.
+ This option is necessary because the SVN library has serious memory
+ leaks; the recommended value for nontrivial imports is 100.
+
+ git-svnimport will still exit with a zero exit code. You can check
+ the size of the file ".git/svn2git" to determine whether to call
+ the importer again.
+
-v::
Verbosity: let 'svnimport' report what it is doing.
diff --git a/git-svnimport.perl b/git-svnimport.perl
index 00f563daec02149583cb4b1db2c3a8d679e1c6ed..b880297e0c3fdb5778f66311f6eef89c6dd16ed7 100755 (executable)
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
$SIG{'PIPE'}="IGNORE";
$ENV{'TZ'}="UTC";
-our($opt_h,$opt_o,$opt_v,$opt_u,$opt_C,$opt_i,$opt_m,$opt_M,$opt_t,$opt_T,$opt_b,$opt_s);
+our($opt_h,$opt_o,$opt_v,$opt_u,$opt_C,$opt_i,$opt_m,$opt_M,$opt_t,$opt_T,$opt_b,$opt_s,$opt_l);
sub usage() {
print STDERR <<END;
Usage: ${\basename $0} # fetch/update GIT from CVS
- [-o branch-for-HEAD] [-h] [-v]
+ [-o branch-for-HEAD] [-h] [-v] [-l max_num_changes]
[-C GIT_repository] [-t tagname] [-T trunkname] [-b branchname]
[-i] [-u] [-s start_chg] [-m] [-M regex] [SVN_URL]
END
exit(1);
}
-getopts("b:C:hivmM:o:s:t:T:u") or usage();
+getopts("b:C:hil:mM:o:s:t:T:uv") or usage();
usage if $opt_h;
my $tag_name = $opt_t || "tags";
@ARGV <= 1 or usage();
$opt_o ||= "origin";
+$opt_l = 100 unless defined $opt_l;
my $git_tree = $opt_C;
$git_tree ||= ".";
while(++$current_rev < $svn->{'maxrev'}) {
$svn->{'svn'}->get_log("/",$current_rev,$current_rev,$current_rev,1,1,\&_commit_all,"");
commit_all();
+ if($opt_l and not --$opt_l) {
+ print STDERR "Exiting due to a memory leak. Repeat, please.\n";
+ last;
+ }
}
# Now switch back to the branch we were in before all of this happened
if($orig_branch) {
- print "DONE\n" if $opt_v;
+ print "DONE\n" if $opt_v and (not defined $opt_l or $opt_l > 0);
system("cp","$git_dir/refs/heads/$opt_o","$git_dir/refs/heads/master")
if $forward_master;
unless ($opt_i) {
}
} else {
$orig_branch = "master";
- print "DONE; creating $orig_branch branch\n" if $opt_v;
+ print "DONE; creating $orig_branch branch\n" if $opt_v and (not defined $opt_l or $opt_l > 0);
system("cp","$git_dir/refs/heads/$opt_o","$git_dir/refs/heads/master")
unless -f "$git_dir/refs/heads/master";
unlink("$git_dir/HEAD");