@matheusbsbs / matheus-bagliano / commits / 80f50749da
Fork 0

git-svn: be verbose by default on fetch/commit, add -q/--quiet option

Slower connections can make git-svn look as if it's doing nothing for a long time; leaving the user wondering if we're actually doing anything. Now we print some file progress just to assure the user that something is going on while they're waiting. Added the -q/--quiet option to users to revert to the old method if they preferred it. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Eric Wong committed Jun 27, 2006 at 19:39 UTC 80f50749da3441502aabd5b6c5129c9eb3bdf870
1 file changed +23 -11
contrib/git-svn/git-svn.perl
+23 -11
@@ -46,7 +46,7 @@ my $sha1 = qr/[a-f\d]{40}/;
46 my $sha1_short = qr/[a-f\d]{4,40}/;
47 my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,
48 $_find_copies_harder, $_l, $_cp_similarity, $_cp_remote,
49 - $_repack, $_repack_nr, $_repack_flags,
49 + $_repack, $_repack_nr, $_repack_flags, $_q,
50 $_message, $_file, $_follow_parent, $_no_metadata,
51 $_template, $_shared, $_no_default_regex, $_no_graft_copy,
52 $_limit, $_verbose, $_incremental, $_oneline, $_l_fmt, $_show_commit,
@@ -62,6 +62,7 @@ my %fc_opts = ( 'no-ignore-externals' => \$_no_ignore_ext,
62 'authors-file|A=s' => \$_authors,
63 'repack:i' => \$_repack,
64 'no-metadata' => \$_no_metadata,
65 + 'quiet|q' => \$_q,
66 'repack-flags|repack-args|repack-opts=s' => \$_repack_flags);
67
68 my ($_trunk, $_tags, $_branches);
@@ -1454,12 +1455,12 @@ sub libsvn_checkout_tree {
1455 foreach my $m (sort { $o{$a->{chg}} <=> $o{$b->{chg}} } @$mods) {
1456 my $f = $m->{chg};
1457 if (defined $o{$f}) {
1457 - $ed->$f($m);
1458 + $ed->$f($m, $_q);
1459 } else {
1460 croak "Invalid change type: $f\n";
1461 }
1462 }
1462 - $ed->rmdirs if $_rmdir;
1463 + $ed->rmdirs($_q) if $_rmdir;
1464 return $mods;
1465 }
1466
@@ -2685,6 +2686,7 @@ sub libsvn_fetch {
2686 my $m = $paths->{$f}->action();
2687 $f =~ s#^/+##;
2688 if ($m =~ /^[DR]$/) {
2689 + print "\t$m\t$f\n" unless $_q;
2690 process_rm($gui, $last_commit, $f);
2691 next if $m eq 'D';
2692 # 'R' can be file replacements, too, right?
@@ -2693,14 +2695,17 @@ sub libsvn_fetch {
2695 my $t = $SVN->check_path($f, $rev, $pool);
2696 if ($t == $SVN::Node::file) {
2697 if ($m =~ /^[AMR]$/) {
2696 - push @amr, $f;
2698 + push @amr, [ $m, $f ];
2699 } else {
2700 die "Unrecognized action: $m, ($f r$rev)\n";
2701 }
2702 }
2703 $pool->clear;
2704 }
2703 - libsvn_get_file($gui, $_, $rev) foreach (@amr);
2705 + foreach (@amr) {
2706 + print "\t$_->[0]\t$_->[1]\n" unless $_q;
2707 + libsvn_get_file($gui, $_->[1], $rev)
2708 + }
2709 close $gui or croak $?;
2710 return libsvn_log_entry($rev, $author, $date, $msg, [$last_commit]);
2711 }
@@ -2773,6 +2778,7 @@ sub libsvn_traverse {
2778 if ($t == $SVN::Node::dir) {
2779 libsvn_traverse($gui, $cwd, $d, $rev);
2780 } elsif ($t == $SVN::Node::file) {
2781 + print "\tA\t$cwd/$d\n" unless $_q;
2782 libsvn_get_file($gui, "$cwd/$d", $rev);
2783 }
2784 }
@@ -3109,7 +3115,7 @@ sub url_path {
3115 }
3116
3117 sub rmdirs {
3112 - my ($self) = @_;
3118 + my ($self, $q) = @_;
3119 my $rm = $self->{rm};
3120 delete $rm->{''}; # we never delete the url we're tracking
3121 return unless %$rm;
@@ -3150,6 +3156,7 @@ sub rmdirs {
3156 foreach my $d (sort { $b =~ tr#/#/# <=> $a =~ tr#/#/# } keys %$rm) {
3157 $self->close_directory($bat->{$d}, $p);
3158 my ($dn) = ($d =~ m#^(.*?)/?(?:[^/]+)$#);
3159 + print "\tD+\t/$d/\n" unless $q;
3160 $self->SUPER::delete_entry($d, $r, $bat->{$dn}, $p);
3161 delete $bat->{$d};
3162 }
@@ -3190,21 +3197,23 @@ sub ensure_path {
3197 }
3198
3199 sub A {
3193 - my ($self, $m) = @_;
3200 + my ($self, $m, $q) = @_;
3201 my ($dir, $file) = split_path($m->{file_b});
3202 my $pbat = $self->ensure_path($dir);
3203 my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
3204 undef, -1);
3205 + print "\tA\t$m->{file_b}\n" unless $q;
3206 $self->chg_file($fbat, $m);
3207 $self->close_file($fbat,undef,$self->{pool});
3208 }
3209
3210 sub C {
3203 - my ($self, $m) = @_;
3211 + my ($self, $m, $q) = @_;
3212 my ($dir, $file) = split_path($m->{file_b});
3213 my $pbat = $self->ensure_path($dir);
3214 my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
3215 $self->url_path($m->{file_a}), $self->{r});
3216 + print "\tC\t$m->{file_a} => $m->{file_b}\n" unless $q;
3217 $self->chg_file($fbat, $m);
3218 $self->close_file($fbat,undef,$self->{pool});
3219 }
@@ -3218,11 +3227,12 @@ sub delete_entry {
3227 }
3228
3229 sub R {
3221 - my ($self, $m) = @_;
3230 + my ($self, $m, $q) = @_;
3231 my ($dir, $file) = split_path($m->{file_b});
3232 my $pbat = $self->ensure_path($dir);
3233 my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
3234 $self->url_path($m->{file_a}), $self->{r});
3235 + print "\tR\t$m->{file_a} => $m->{file_b}\n" unless $q;
3236 $self->chg_file($fbat, $m);
3237 $self->close_file($fbat,undef,$self->{pool});
3238
@@ -3232,11 +3242,12 @@ sub R {
3242 }
3243
3244 sub M {
3235 - my ($self, $m) = @_;
3245 + my ($self, $m, $q) = @_;
3246 my ($dir, $file) = split_path($m->{file_b});
3247 my $pbat = $self->ensure_path($dir);
3248 my $fbat = $self->open_file($self->repo_path($m->{file_b}),
3249 $pbat,$self->{r},$self->{pool});
3250 + print "\t$m->{chg}\t$m->{file_b}\n" unless $q;
3251 $self->chg_file($fbat, $m);
3252 $self->close_file($fbat,undef,$self->{pool});
3253 }
@@ -3285,9 +3296,10 @@ sub chg_file {
3296 }
3297
3298 sub D {
3288 - my ($self, $m) = @_;
3299 + my ($self, $m, $q) = @_;
3300 my ($dir, $file) = split_path($m->{file_b});
3301 my $pbat = $self->ensure_path($dir);
3302 + print "\tD\t$m->{file_b}\n" unless $q;
3303 $self->delete_entry($m->{file_b}, $pbat);
3304 }
3305