Skip to content

Commit 80f5074

Browse files
Eric WongJunio C Hamano
authored andcommitted
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>
1 parent a00439a commit 80f5074

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

contrib/git-svn/git-svn.perl

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
my $sha1_short = qr/[a-f\d]{4,40}/;
4747
my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,
4848
$_find_copies_harder, $_l, $_cp_similarity, $_cp_remote,
49-
$_repack, $_repack_nr, $_repack_flags,
49+
$_repack, $_repack_nr, $_repack_flags, $_q,
5050
$_message, $_file, $_follow_parent, $_no_metadata,
5151
$_template, $_shared, $_no_default_regex, $_no_graft_copy,
5252
$_limit, $_verbose, $_incremental, $_oneline, $_l_fmt, $_show_commit,
@@ -62,6 +62,7 @@
6262
'authors-file|A=s' => \$_authors,
6363
'repack:i' => \$_repack,
6464
'no-metadata' => \$_no_metadata,
65+
'quiet|q' => \$_q,
6566
'repack-flags|repack-args|repack-opts=s' => \$_repack_flags);
6667

6768
my ($_trunk, $_tags, $_branches);
@@ -1454,12 +1455,12 @@ sub libsvn_checkout_tree {
14541455
foreach my $m (sort { $o{$a->{chg}} <=> $o{$b->{chg}} } @$mods) {
14551456
my $f = $m->{chg};
14561457
if (defined $o{$f}) {
1457-
$ed->$f($m);
1458+
$ed->$f($m, $_q);
14581459
} else {
14591460
croak "Invalid change type: $f\n";
14601461
}
14611462
}
1462-
$ed->rmdirs if $_rmdir;
1463+
$ed->rmdirs($_q) if $_rmdir;
14631464
return $mods;
14641465
}
14651466

@@ -2685,6 +2686,7 @@ sub libsvn_fetch {
26852686
my $m = $paths->{$f}->action();
26862687
$f =~ s#^/+##;
26872688
if ($m =~ /^[DR]$/) {
2689+
print "\t$m\t$f\n" unless $_q;
26882690
process_rm($gui, $last_commit, $f);
26892691
next if $m eq 'D';
26902692
# 'R' can be file replacements, too, right?
@@ -2693,14 +2695,17 @@ sub libsvn_fetch {
26932695
my $t = $SVN->check_path($f, $rev, $pool);
26942696
if ($t == $SVN::Node::file) {
26952697
if ($m =~ /^[AMR]$/) {
2696-
push @amr, $f;
2698+
push @amr, [ $m, $f ];
26972699
} else {
26982700
die "Unrecognized action: $m, ($f r$rev)\n";
26992701
}
27002702
}
27012703
$pool->clear;
27022704
}
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+
}
27042709
close $gui or croak $?;
27052710
return libsvn_log_entry($rev, $author, $date, $msg, [$last_commit]);
27062711
}
@@ -2773,6 +2778,7 @@ sub libsvn_traverse {
27732778
if ($t == $SVN::Node::dir) {
27742779
libsvn_traverse($gui, $cwd, $d, $rev);
27752780
} elsif ($t == $SVN::Node::file) {
2781+
print "\tA\t$cwd/$d\n" unless $_q;
27762782
libsvn_get_file($gui, "$cwd/$d", $rev);
27772783
}
27782784
}
@@ -3109,7 +3115,7 @@ sub url_path {
31093115
}
31103116

31113117
sub rmdirs {
3112-
my ($self) = @_;
3118+
my ($self, $q) = @_;
31133119
my $rm = $self->{rm};
31143120
delete $rm->{''}; # we never delete the url we're tracking
31153121
return unless %$rm;
@@ -3150,6 +3156,7 @@ sub rmdirs {
31503156
foreach my $d (sort { $b =~ tr#/#/# <=> $a =~ tr#/#/# } keys %$rm) {
31513157
$self->close_directory($bat->{$d}, $p);
31523158
my ($dn) = ($d =~ m#^(.*?)/?(?:[^/]+)$#);
3159+
print "\tD+\t/$d/\n" unless $q;
31533160
$self->SUPER::delete_entry($d, $r, $bat->{$dn}, $p);
31543161
delete $bat->{$d};
31553162
}
@@ -3190,21 +3197,23 @@ sub ensure_path {
31903197
}
31913198

31923199
sub A {
3193-
my ($self, $m) = @_;
3200+
my ($self, $m, $q) = @_;
31943201
my ($dir, $file) = split_path($m->{file_b});
31953202
my $pbat = $self->ensure_path($dir);
31963203
my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
31973204
undef, -1);
3205+
print "\tA\t$m->{file_b}\n" unless $q;
31983206
$self->chg_file($fbat, $m);
31993207
$self->close_file($fbat,undef,$self->{pool});
32003208
}
32013209

32023210
sub C {
3203-
my ($self, $m) = @_;
3211+
my ($self, $m, $q) = @_;
32043212
my ($dir, $file) = split_path($m->{file_b});
32053213
my $pbat = $self->ensure_path($dir);
32063214
my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
32073215
$self->url_path($m->{file_a}), $self->{r});
3216+
print "\tC\t$m->{file_a} => $m->{file_b}\n" unless $q;
32083217
$self->chg_file($fbat, $m);
32093218
$self->close_file($fbat,undef,$self->{pool});
32103219
}
@@ -3218,11 +3227,12 @@ sub delete_entry {
32183227
}
32193228

32203229
sub R {
3221-
my ($self, $m) = @_;
3230+
my ($self, $m, $q) = @_;
32223231
my ($dir, $file) = split_path($m->{file_b});
32233232
my $pbat = $self->ensure_path($dir);
32243233
my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
32253234
$self->url_path($m->{file_a}), $self->{r});
3235+
print "\tR\t$m->{file_a} => $m->{file_b}\n" unless $q;
32263236
$self->chg_file($fbat, $m);
32273237
$self->close_file($fbat,undef,$self->{pool});
32283238

@@ -3232,11 +3242,12 @@ sub R {
32323242
}
32333243

32343244
sub M {
3235-
my ($self, $m) = @_;
3245+
my ($self, $m, $q) = @_;
32363246
my ($dir, $file) = split_path($m->{file_b});
32373247
my $pbat = $self->ensure_path($dir);
32383248
my $fbat = $self->open_file($self->repo_path($m->{file_b}),
32393249
$pbat,$self->{r},$self->{pool});
3250+
print "\t$m->{chg}\t$m->{file_b}\n" unless $q;
32403251
$self->chg_file($fbat, $m);
32413252
$self->close_file($fbat,undef,$self->{pool});
32423253
}
@@ -3285,9 +3296,10 @@ sub chg_file {
32853296
}
32863297

32873298
sub D {
3288-
my ($self, $m) = @_;
3299+
my ($self, $m, $q) = @_;
32893300
my ($dir, $file) = split_path($m->{file_b});
32903301
my $pbat = $self->ensure_path($dir);
3302+
print "\tD\t$m->{file_b}\n" unless $q;
32913303
$self->delete_entry($m->{file_b}, $pbat);
32923304
}
32933305

0 commit comments

Comments
 (0)