@matheusbsbs / matheus-bagliano / commits / 6af1db447b
Fork 0

git-svn: allow --log-window-size to be specified, default to 100

The newer default value should should lower memory usage for large fetches and also help with fetching from less reliable servers. Previously the value was 1000 and memory usage got a bit high on some repositories and fetching became less reliable in some cases. Signed-off-by: Eric Wong <normalperson@yhbt.net>

Eric Wong committed Feb 14, 2007 at 16:04 UTC 6af1db447b10c03db4c04a55000efaa9aad38caa
1 file changed +7 -2
git-svn.perl
+7 -2
@@ -12,6 +12,7 @@ $VERSION = '@@GIT_VERSION@@';
12 $ENV{GIT_DIR} ||= '.git';
13 $Git::SVN::default_repo_id = 'svn';
14 $Git::SVN::default_ref_id = $ENV{GIT_SVN_ID} || 'git-svn';
15 +$Git::SVN::Ra::_log_window_size = 100;
16
17 $Git::SVN::Log::TZ = $ENV{TZ};
18 $ENV{TZ} = 'UTC';
@@ -65,6 +66,7 @@ my %fc_opts = ( 'follow-parent|follow!' => \$Git::SVN::_follow_parent,
66 'repack:i' => \$Git::SVN::_repack,
67 'noMetadata' => \$Git::SVN::_no_metadata,
68 'useSvmProps' => \$Git::SVN::_use_svm_props,
69 + 'log-window-size=i' => \$Git::SVN::Ra::_log_window_size,
70 'quiet|q' => \$_q,
71 'repack-flags|repack-args|repack-opts=s' =>
72 \$Git::SVN::_repack_flags,
@@ -2583,7 +2585,7 @@ sub apply_diff {
2585 }
2586
2587 package Git::SVN::Ra;
2586 -use vars qw/@ISA $config_dir/;
2588 +use vars qw/@ISA $config_dir $_log_window_size/;
2589 use strict;
2590 use warnings;
2591 my ($can_do_switch);
@@ -2747,7 +2749,7 @@ sub gs_do_switch {
2749 sub gs_fetch_loop_common {
2750 my ($self, $base, $head, $gsv, $globs) = @_;
2751 return if ($base > $head);
2750 - my $inc = 1000;
2752 + my $inc = $_log_window_size;
2753 my ($min, $max) = ($base, $head < $base + $inc ? $head : $base + $inc);
2754 my %common;
2755 my $common_max = scalar @$gsv;
@@ -2954,6 +2956,9 @@ sub skip_unknown_revs {
2956 # 175007 - http(s):// (this repo required authorization, too...)
2957 # More codes may be discovered later...
2958 if ($errno == 175007 || $errno == 175002 || $errno == 160013) {
2959 + warn "W: Ignoring error from SVN, path probably ",
2960 + "does not exist: ($errno): ",
2961 + $err->expanded_message,"\n";
2962 return;
2963 }
2964 die "Error from SVN, ($errno): ", $err->expanded_message,"\n";