@matheusbsbs / matheus-bagliano / commits / b9c8518722
Fork 0

git-svn: remove support for the svn command-line client

Using the command-line client was great for prototyping and getting something working quickly. Eventually I found time to study the library documentation and add support for using the libraries which are much faster and more flexible when it comes to supporting new features. Note that we require version 1.1 of the SVN libraries, whereas we supported the command-line svn client down to version 1.0. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Eric Wong committed Dec 15, 2006 at 23:58 UTC b9c8518722687fae6182162f9a244915ba94db02
7 files changed +51 -882
git-svn.perl
+39 -844
@@ -32,17 +32,20 @@ my %SKIP = ( 'svn:wc:ra_dav:version-url' => 1,
32 );
33
34 sub fatal (@) { print STDERR @_; exit 1 }
35 -# If SVN:: library support is added, please make the dependencies
36 -# optional and preserve the capability to use the command-line client.
37 -# use eval { require SVN::... } to make it lazy load
38 -# We don't use any modules not in the standard Perl distribution:
35 +require SVN::Core; # use()-ing this causes segfaults for me... *shrug*
36 +require SVN::Ra;
37 +require SVN::Delta;
38 +if ($SVN::Core::VERSION lt '1.1.0') {
39 + fatal "Need SVN::Core 1.1.0 or better (got $SVN::Core::VERSION)\n";
40 +}
41 +push @SVN::Git::Editor::ISA, 'SVN::Delta::Editor';
42 +push @SVN::Git::Fetcher::ISA, 'SVN::Delta::Editor';
43 +*SVN::Git::Fetcher::process_rm = *process_rm;
44 use Carp qw/croak/;
45 use IO::File qw//;
46 use File::Basename qw/dirname basename/;
47 use File::Path qw/mkpath/;
48 use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev pass_through/;
44 -use File::Spec qw//;
45 -use File::Copy qw/copy/;
49 use POSIX qw/strftime/;
50 use IPC::Open3;
51 use Memoize;
@@ -52,22 +55,7 @@ memoize('revisions_eq');
55 memoize('cmt_metadata');
56 memoize('get_commit_time');
57
55 -my ($SVN, $_use_lib);
56 -
57 -sub nag_lib {
58 - print STDERR <<EOF;
59 -! Please consider installing the SVN Perl libraries (version 1.1.0 or
60 -! newer). You will generally get better performance and fewer bugs,
61 -! especially if you:
62 -! 1) have a case-insensitive filesystem
63 -! 2) replace symlinks with files (and vice-versa) in commits
64 -
65 -EOF
66 -}
67 -
68 -$_use_lib = 1 unless $ENV{GIT_SVN_NO_LIB};
69 -libsvn_load();
70 -nag_lib() unless $_use_lib;
58 +my ($SVN);
59
60 my $_optimize_commits = 1 unless $ENV{GIT_SVN_NO_OPTIMIZE_COMMITS};
61 my $sha1 = qr/[a-f\d]{40}/;
@@ -84,7 +72,7 @@ my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,
72 $_username, $_config_dir, $_no_auth_cache, $_xfer_delta,
73 $_pager, $_color);
74 my (@_branch_from, %tree_map, %users, %rusers, %equiv);
87 -my ($_svn_co_url_revs, $_svn_pg_peg_revs, $_svn_can_do_switch);
75 +my ($_svn_can_do_switch);
76 my @repo_path_split_cache;
77
78 my %fc_opts = ( 'no-ignore-externals' => \$_no_ignore_ext,
@@ -193,7 +181,6 @@ usage(1) unless defined $cmd;
181 init_vars();
182 load_authors() if $_authors;
183 load_all_refs() if $_branch_all_refs;
196 -svn_compat_check() unless $_use_lib;
184 migration_check() unless $cmd =~ /^(?:init|rebuild|multi-init|commit-diff)$/;
185 $cmd{$cmd}->[0]->(@ARGV);
186 exit 0;
@@ -281,32 +268,6 @@ sub rebuild {
268 $newest_rev = $rev if ($rev > $newest_rev);
269 }
270 command_close_pipe($rev_list, $ctx);
284 -
285 - goto out if $_use_lib;
286 - if (!chdir $SVN_WC) {
287 - svn_cmd_checkout($SVN_URL, $latest, $SVN_WC);
288 - chdir $SVN_WC or croak $!;
289 - }
290 -
291 - my $pid = fork;
292 - defined $pid or croak $!;
293 - if ($pid == 0) {
294 - my @svn_up = qw(svn up);
295 - push @svn_up, '--ignore-externals' unless $_no_ignore_ext;
296 - sys(@svn_up,"-r$newest_rev");
297 - $ENV{GIT_INDEX_FILE} = $GIT_SVN_INDEX;
298 - index_changes();
299 - exec('git-write-tree') or croak $!;
300 - }
301 - waitpid $pid, 0;
302 - croak $? if $?;
303 -out:
304 - if ($_upgrade) {
305 - print STDERR <<"";
306 -Keeping deprecated refs/head/$GIT_SVN-HEAD for now. Please remove it
307 -when you have upgraded your tools and habits to use refs/remotes/$GIT_SVN
308 -
309 - }
271 }
272
273 sub init {
@@ -335,69 +296,13 @@ sub init {
296 sub fetch {
297 check_upgrade_needed();
298 $SVN_URL ||= file_to_s("$GIT_SVN_DIR/info/url");
338 - my $ret = $_use_lib ? fetch_lib(@_) : fetch_cmd(@_);
299 + my $ret = fetch_lib(@_);
300 if ($ret->{commit} && !verify_ref('refs/heads/master^0')) {
301 command_noisy(qw(update-ref refs/heads/master),$ret->{commit});
302 }
303 return $ret;
304 }
305
345 -sub fetch_cmd {
346 - my (@parents) = @_;
347 - my @log_args = -d $SVN_WC ? ($SVN_WC) : ($SVN_URL);
348 - unless ($_revision) {
349 - $_revision = -d $SVN_WC ? 'BASE:HEAD' : '0:HEAD';
350 - }
351 - push @log_args, "-r$_revision";
352 - push @log_args, '--stop-on-copy' unless $_no_stop_copy;
353 -
354 - my $svn_log = svn_log_raw(@log_args);
355 -
356 - my $base = next_log_entry($svn_log) or croak "No base revision!\n";
357 - # don't need last_revision from grab_base_rev() because
358 - # user could've specified a different revision to skip (they
359 - # didn't want to import certain revisions into git for whatever
360 - # reason, so trust $base->{revision} instead.
361 - my (undef, $last_commit) = svn_grab_base_rev();
362 - unless (-d $SVN_WC) {
363 - svn_cmd_checkout($SVN_URL,$base->{revision},$SVN_WC);
364 - chdir $SVN_WC or croak $!;
365 - read_uuid();
366 - $last_commit = git_commit($base, @parents);
367 - assert_tree($last_commit);
368 - } else {
369 - chdir $SVN_WC or croak $!;
370 - read_uuid();
371 - # looks like a user manually cp'd and svn switch'ed
372 - unless ($last_commit) {
373 - sys(qw/svn revert -R ./);
374 - assert_svn_wc_clean($base->{revision});
375 - $last_commit = git_commit($base, @parents);
376 - assert_tree($last_commit);
377 - }
378 - }
379 - my @svn_up = qw(svn up);
380 - push @svn_up, '--ignore-externals' unless $_no_ignore_ext;
381 - my $last = $base;
382 - while (my $log_msg = next_log_entry($svn_log)) {
383 - if ($last->{revision} >= $log_msg->{revision}) {
384 - croak "Out of order: last >= current: ",
385 - "$last->{revision} >= $log_msg->{revision}\n";
386 - }
387 - # Revert is needed for cases like:
388 - # https://svn.musicpd.org/Jamming/trunk (r166:167), but
389 - # I can't seem to reproduce something like that on a test...
390 - sys(qw/svn revert -R ./);
391 - assert_svn_wc_clean($last->{revision});
392 - sys(@svn_up,"-r$log_msg->{revision}");
393 - $last_commit = git_commit($log_msg, $last_commit, @parents);
394 - $last = $log_msg;
395 - }
396 - close $svn_log->{fh};
397 - $last->{commit} = $last_commit;
398 - return $last;
399 -}
400 -
306 sub fetch_lib {
307 my (@parents) = @_;
308 $SVN_URL ||= file_to_s("$GIT_SVN_DIR/info/url");
@@ -498,35 +403,10 @@ sub commit {
403 die "Failed to rev-parse $c\n";
404 }
405 }
501 - $_use_lib ? commit_lib(@revs) : commit_cmd(@revs);
406 + commit_lib(@revs);
407 print "Done committing ",scalar @revs," revisions to SVN\n";
408 }
409
505 -sub commit_cmd {
506 - my (@revs) = @_;
507 -
508 - chdir $SVN_WC or croak "Unable to chdir $SVN_WC: $!\n";
509 - my $info = svn_info('.');
510 - my $fetched = fetch();
511 - if ($info->{Revision} != $fetched->{revision}) {
512 - print STDERR "There are new revisions that were fetched ",
513 - "and need to be merged (or acknowledged) ",
514 - "before committing.\n";
515 - exit 1;
516 - }
517 - $info = svn_info('.');
518 - read_uuid($info);
519 - my $last = $fetched;
520 - foreach my $c (@revs) {
521 - my $mods = svn_checkout_tree($last, $c);
522 - if (scalar @$mods == 0) {
523 - print "Skipping, no changes detected\n";
524 - next;
525 - }
526 - $last = svn_commit_tree($last, $c);
527 - }
528 -}
529 -
410 sub commit_lib {
411 my (@revs) = @_;
412 my ($r_last, $cmt_last) = svn_grab_base_rev();
@@ -649,32 +529,6 @@ sub dcommit {
529
530 sub show_ignore {
531 $SVN_URL ||= file_to_s("$GIT_SVN_DIR/info/url");
652 - $_use_lib ? show_ignore_lib() : show_ignore_cmd();
653 -}
654 -
655 -sub show_ignore_cmd {
656 - require File::Find or die $!;
657 - if (defined $_revision) {
658 - die "-r/--revision option doesn't work unless the Perl SVN ",
659 - "libraries are used\n";
660 - }
661 - chdir $SVN_WC or croak $!;
662 - my %ign;
663 - File::Find::find({wanted=>sub{if(lstat $_ && -d _ && -d "$_/.svn"){
664 - s#^\./##;
665 - @{$ign{$_}} = svn_propget_base('svn:ignore', $_);
666 - }}, no_chdir=>1},'.');
667 -
668 - print "\n# /\n";
669 - foreach (@{$ign{'.'}}) { print '/',$_ if /\S/ }
670 - delete $ign{'.'};
671 - foreach my $i (sort keys %ign) {
672 - print "\n# ",$i,"\n";
673 - foreach (@{$ign{$i}}) { print '/',$i,'/',$_ if /\S/ }
674 - }
675 -}
676 -
677 -sub show_ignore_lib {
532 my $repo;
533 $SVN ||= libsvn_connect($SVN_URL);
534 my $r = defined $_revision ? $_revision : $SVN->get_latest_revnum;
@@ -706,11 +560,7 @@ sub graft_branches {
560 }
561 }
562 unless ($_no_graft_copy) {
709 - if ($_use_lib) {
710 - graft_file_copy_lib($grafts,$l_map,$u);
711 - } else {
712 - graft_file_copy_cmd($grafts,$l_map,$u);
713 - }
563 + graft_file_copy_lib($grafts,$l_map,$u);
564 }
565 }
566 graft_tree_joins($grafts);
@@ -838,10 +688,6 @@ sub commit_diff_usage {
688 }
689
690 sub commit_diff {
841 - if (!$_use_lib) {
842 - print STDERR "commit-diff must be used with SVN libraries\n";
843 - exit 1;
844 - }
691 my $ta = shift or commit_diff_usage();
692 my $tb = shift or commit_diff_usage();
693 if (!eval { $SVN_URL = shift || file_to_s("$GIT_SVN_DIR/info/url") }) {
@@ -1042,8 +888,7 @@ sub complete_url_ls_init {
888 }
889 $var = $url . $var;
890 }
1045 - chomp(my @ls = $_use_lib ? libsvn_ls_fullurl($var)
1046 - : safe_qx(qw/svn ls --non-interactive/, $var));
891 + my @ls = libsvn_ls_fullurl($var);
892 my $old = $GIT_SVN;
893 defined(my $pid = fork) or croak $!;
894 if (!$pid) {
@@ -1156,37 +1001,6 @@ sub graft_tree_joins {
1001 });
1002 }
1003
1159 -# this isn't funky-filename safe, but good enough for now...
1160 -sub graft_file_copy_cmd {
1161 - my ($grafts, $l_map, $u) = @_;
1162 - my $paths = $l_map->{$u};
1163 - my $pfx = common_prefix([keys %$paths]);
1164 - $SVN_URL ||= $u.$pfx;
1165 - my $pid = open my $fh, '-|';
1166 - defined $pid or croak $!;
1167 - unless ($pid) {
1168 - my @exec = qw/svn log -v/;
1169 - push @exec, "-r$_revision" if defined $_revision;
1170 - exec @exec, $u.$pfx or croak $!;
1171 - }
1172 - my ($r, $mp) = (undef, undef);
1173 - while (<$fh>) {
1174 - chomp;
1175 - if (/^\-{72}$/) {
1176 - $mp = $r = undef;
1177 - } elsif (/^r(\d+) \| /) {
1178 - $r = $1 unless defined $r;
1179 - } elsif (/^Changed paths:/) {
1180 - $mp = 1;
1181 - } elsif ($mp && m#^ [AR] /(\S.*?) \(from /(\S+?):(\d+)\)$#) {
1182 - my ($p1, $p0, $r0) = ($1, $2, $3);
1183 - my $c = find_graft_path_commit($paths, $p1, $r);
1184 - next unless $c;
1185 - find_graft_path_parents($grafts, $paths, $c, $p0, $r0);
1186 - }
1187 - }
1188 -}
1189 -
1004 sub graft_file_copy_lib {
1005 my ($grafts, $l_map, $u) = @_;
1006 my $tree_paths = $l_map->{$u};
@@ -1277,15 +1091,9 @@ sub graft_merge_msg {
1091
1092 sub read_uuid {
1093 return if $SVN_UUID;
1280 - if ($_use_lib) {
1281 - my $pool = SVN::Pool->new;
1282 - $SVN_UUID = $SVN->get_uuid($pool);
1283 - $pool->clear;
1284 - } else {
1285 - my $info = shift || svn_info('.');
1286 - $SVN_UUID = $info->{'Repository UUID'} or
1287 - croak "Repository UUID unreadable\n";
1288 - }
1094 + my $pool = SVN::Pool->new;
1095 + $SVN_UUID = $SVN->get_uuid($pool);
1096 + $pool->clear;
1097 }
1098
1099 sub verify_ref {
@@ -1293,19 +1101,6 @@ sub verify_ref {
1101 eval { command_oneline([ 'rev-parse', $ref ], { STDERR => 0 }) };
1102 }
1103
1296 -sub quiet_run {
1297 - my $pid = fork;
1298 - defined $pid or croak $!;
1299 - if (!$pid) {
1300 - open my $null, '>', '/dev/null' or croak $!;
1301 - open STDERR, '>&', $null or croak $!;
1302 - open STDOUT, '>&', $null or croak $!;
1303 - exec @_ or croak $!;
1304 - }
1305 - waitpid $pid, 0;
1306 - return $?;
1307 -}
1308 -
1104 sub repo_path_split {
1105 my $full_url = shift;
1106 $full_url =~ s#/+$##;
@@ -1317,21 +1112,8 @@ sub repo_path_split {
1112 return ($u, $full_url);
1113 }
1114 }
1320 - if ($_use_lib) {
1321 - my $tmp = libsvn_connect($full_url);
1322 - return ($tmp->{repos_root}, $tmp->{svn_path});
1323 - } else {
1324 - my ($url, $path) = ($full_url =~ m!^([a-z\+]+://[^/]*)(.*)$!i);
1325 - $path =~ s#^/+##;
1326 - my @paths = split(m#/+#, $path);
1327 - while (quiet_run(qw/svn ls --non-interactive/, $url)) {
1328 - my $n = shift @paths || last;
1329 - $url .= "/$n";
1330 - }
1331 - push @repo_path_split_cache, qr/^(\Q$url\E)/;
1332 - $path = join('/',@paths);
1333 - return ($url, $path);
1334 - }
1115 + my $tmp = libsvn_connect($full_url);
1116 + return ($tmp->{repos_root}, $tmp->{svn_path});
1117 }
1118
1119 sub setup_git_svn {
@@ -1347,31 +1129,6 @@ sub setup_git_svn {
1129
1130 }
1131
1350 -sub assert_svn_wc_clean {
1351 - return if $_use_lib;
1352 - my ($svn_rev) = @_;
1353 - croak "$svn_rev is not an integer!\n" unless ($svn_rev =~ /^\d+$/);
1354 - my $lcr = svn_info('.')->{'Last Changed Rev'};
1355 - if ($svn_rev != $lcr) {
1356 - print STDERR "Checking for copy-tree ... ";
1357 - my @diff = grep(/^Index: /,(safe_qx(qw(svn diff),
1358 - "-r$lcr:$svn_rev")));
1359 - if (@diff) {
1360 - croak "Nope! Expected r$svn_rev, got r$lcr\n";
1361 - } else {
1362 - print STDERR "OK!\n";
1363 - }
1364 - }
1365 - my @status = grep(!/^Performing status on external/,(`svn status`));
1366 - @status = grep(!/^\s*$/,@status);
1367 - @status = grep(!/^X/,@status) if $_no_ignore_ext;
1368 - if (scalar @status) {
1369 - print STDERR "Tree ($SVN_WC) is not clean:\n";
1370 - print STDERR $_ foreach @status;
1371 - croak;
1372 - }
1373 -}
1374 -
1132 sub get_tree_from_treeish {
1133 my ($treeish) = @_;
1134 croak "Not a sha1: $treeish\n" unless $treeish =~ /^$sha1$/o;
@@ -1393,28 +1150,8 @@ sub get_tree_from_treeish {
1150 return $expected;
1151 }
1152
1396 -sub assert_tree {
1397 - return if $_use_lib;
1398 - my ($treeish) = @_;
1399 - my $expected = get_tree_from_treeish($treeish);
1400 -
1401 - my $tmpindex = $GIT_SVN_INDEX.'.assert-tmp';
1402 - if (-e $tmpindex) {
1403 - unlink $tmpindex or croak $!;
1404 - }
1405 - my $old_index = set_index($tmpindex);
1406 - index_changes(1);
1407 - my $tree = command_oneline('write-tree');
1408 - restore_index($old_index);
1409 - if ($tree ne $expected) {
1410 - croak "Tree mismatch, Got: $tree, Expected: $expected\n";
1411 - }
1412 - unlink $tmpindex;
1413 -}
1414 -
1153 sub get_diff {
1154 my ($from, $treeish) = @_;
1417 - assert_tree($from);
1155 print "diff-tree $from $treeish\n";
1156 my @diff_tree = qw(diff-tree -z -r);
1157 if ($_cp_similarity) {
@@ -1465,145 +1202,6 @@ sub get_diff {
1202 return \@mods;
1203 }
1204
1468 -sub svn_check_prop_executable {
1469 - my $m = shift;
1470 - return if -l $m->{file_b};
1471 - if ($m->{mode_b} =~ /755$/) {
1472 - chmod((0755 &~ umask),$m->{file_b}) or croak $!;
1473 - if ($m->{mode_a} !~ /755$/) {
1474 - sys(qw(svn propset svn:executable 1), $m->{file_b});
1475 - }
1476 - -x $m->{file_b} or croak "$m->{file_b} is not executable!\n";
1477 - } elsif ($m->{mode_b} !~ /755$/ && $m->{mode_a} =~ /755$/) {
1478 - sys(qw(svn propdel svn:executable), $m->{file_b});
1479 - chmod((0644 &~ umask),$m->{file_b}) or croak $!;
1480 - -x $m->{file_b} and croak "$m->{file_b} is executable!\n";
1481 - }
1482 -}
1483 -
1484 -sub svn_ensure_parent_path {
1485 - my $dir_b = dirname(shift);
1486 - svn_ensure_parent_path($dir_b) if ($dir_b ne File::Spec->curdir);
1487 - mkpath([$dir_b]) unless (-d $dir_b);
1488 - sys(qw(svn add -N), $dir_b) unless (-d "$dir_b/.svn");
1489 -}
1490 -
1491 -sub precommit_check {
1492 - my $mods = shift;
1493 - my (%rm_file, %rmdir_check, %added_check);
1494 -
1495 - my %o = ( D => 0, R => 1, C => 2, A => 3, M => 3, T => 3 );
1496 - foreach my $m (sort { $o{$a->{chg}} <=> $o{$b->{chg}} } @$mods) {
1497 - if ($m->{chg} eq 'R') {
1498 - if (-d $m->{file_b}) {
1499 - err_dir_to_file("$m->{file_a} => $m->{file_b}");
1500 - }
1501 - # dir/$file => dir/file/$file
1502 - my $dirname = dirname($m->{file_b});
1503 - while ($dirname ne File::Spec->curdir) {
1504 - if ($dirname ne $m->{file_a}) {
1505 - $dirname = dirname($dirname);
1506 - next;
1507 - }
1508 - err_file_to_dir("$m->{file_a} => $m->{file_b}");
1509 - }
1510 - # baz/zzz => baz (baz is a file)
1511 - $dirname = dirname($m->{file_a});
1512 - while ($dirname ne File::Spec->curdir) {
1513 - if ($dirname ne $m->{file_b}) {
1514 - $dirname = dirname($dirname);
1515 - next;
1516 - }
1517 - err_dir_to_file("$m->{file_a} => $m->{file_b}");
1518 - }
1519 - }
1520 - if ($m->{chg} =~ /^(D|R)$/) {
1521 - my $t = $1 eq 'D' ? 'file_b' : 'file_a';
1522 - $rm_file{ $m->{$t} } = 1;
1523 - my $dirname = dirname( $m->{$t} );
1524 - my $basename = basename( $m->{$t} );
1525 - $rmdir_check{$dirname}->{$basename} = 1;
1526 - } elsif ($m->{chg} =~ /^(?:A|C)$/) {
1527 - if (-d $m->{file_b}) {
1528 - err_dir_to_file($m->{file_b});
1529 - }
1530 - my $dirname = dirname( $m->{file_b} );
1531 - my $basename = basename( $m->{file_b} );
1532 - $added_check{$dirname}->{$basename} = 1;
1533 - while ($dirname ne File::Spec->curdir) {
1534 - if ($rm_file{$dirname}) {
1535 - err_file_to_dir($m->{file_b});
1536 - }
1537 - $dirname = dirname $dirname;
1538 - }
1539 - }
1540 - }
1541 - return (\%rmdir_check, \%added_check);
1542 -
1543 - sub err_dir_to_file {
1544 - my $file = shift;
1545 - print STDERR "Node change from directory to file ",
1546 - "is not supported by Subversion: ",$file,"\n";
1547 - exit 1;
1548 - }
1549 - sub err_file_to_dir {
1550 - my $file = shift;
1551 - print STDERR "Node change from file to directory ",
1552 - "is not supported by Subversion: ",$file,"\n";
1553 - exit 1;
1554 - }
1555 -}
1556 -
1557 -
1558 -sub svn_checkout_tree {
1559 - my ($from, $treeish) = @_;
1560 - my $mods = get_diff($from->{commit}, $treeish);
1561 - return $mods unless (scalar @$mods);
1562 - my ($rm, $add) = precommit_check($mods);
1563 -
1564 - my %o = ( D => 1, R => 0, C => -1, A => 3, M => 3, T => 3 );
1565 - foreach my $m (sort { $o{$a->{chg}} <=> $o{$b->{chg}} } @$mods) {
1566 - if ($m->{chg} eq 'C') {
1567 - svn_ensure_parent_path( $m->{file_b} );
1568 - sys(qw(svn cp), $m->{file_a}, $m->{file_b});
1569 - apply_mod_line_blob($m);
1570 - svn_check_prop_executable($m);
1571 - } elsif ($m->{chg} eq 'D') {
1572 - sys(qw(svn rm --force), $m->{file_b});
1573 - } elsif ($m->{chg} eq 'R') {
1574 - svn_ensure_parent_path( $m->{file_b} );
1575 - sys(qw(svn mv --force), $m->{file_a}, $m->{file_b});
1576 - apply_mod_line_blob($m);
1577 - svn_check_prop_executable($m);
1578 - } elsif ($m->{chg} eq 'M') {
1579 - apply_mod_line_blob($m);
1580 - svn_check_prop_executable($m);
1581 - } elsif ($m->{chg} eq 'T') {
1582 - svn_check_prop_executable($m);
1583 - apply_mod_line_blob($m);
1584 - if ($m->{mode_a} =~ /^120/ && $m->{mode_b} !~ /^120/) {
1585 - sys(qw(svn propdel svn:special), $m->{file_b});
1586 - } else {
1587 - sys(qw(svn propset svn:special *),$m->{file_b});
1588 - }
1589 - } elsif ($m->{chg} eq 'A') {
1590 - svn_ensure_parent_path( $m->{file_b} );
1591 - apply_mod_line_blob($m);
1592 - sys(qw(svn add), $m->{file_b});
1593 - svn_check_prop_executable($m);
1594 - } else {
1595 - croak "Invalid chg: $m->{chg}\n";
1596 - }
1597 - }
1598 -
1599 - assert_tree($treeish);
1600 - if ($_rmdir) { # remove empty directories
1601 - handle_rmdir($rm, $add);
1602 - }
1603 - assert_tree($treeish);
1604 - return $mods;
1605 -}
1606 -
1205 sub libsvn_checkout_tree {
1206 my ($from, $treeish, $ed) = @_;
1207 my $mods = get_diff($from, $treeish);
@@ -1621,44 +1219,6 @@ sub libsvn_checkout_tree {
1219 return $mods;
1220 }
1221
1624 -# svn ls doesn't work with respect to the current working tree, but what's
1625 -# in the repository. There's not even an option for it... *sigh*
1626 -# (added files don't show up and removed files remain in the ls listing)
1627 -sub svn_ls_current {
1628 - my ($dir, $rm, $add) = @_;
1629 - chomp(my @ls = safe_qx('svn','ls',$dir));
1630 - my @ret = ();
1631 - foreach (@ls) {
1632 - s#/$##; # trailing slashes are evil
1633 - push @ret, $_ unless $rm->{$dir}->{$_};
1634 - }
1635 - if (exists $add->{$dir}) {
1636 - push @ret, keys %{$add->{$dir}};
1637 - }
1638 - return \@ret;
1639 -}
1640 -
1641 -sub handle_rmdir {
1642 - my ($rm, $add) = @_;
1643 -
1644 - foreach my $dir (sort {length $b <=> length $a} keys %$rm) {
1645 - my $ls = svn_ls_current($dir, $rm, $add);
1646 - next if (scalar @$ls);
1647 - sys(qw(svn rm --force),$dir);
1648 -
1649 - my $dn = dirname $dir;
1650 - $rm->{ $dn }->{ basename $dir } = 1;
1651 - $ls = svn_ls_current($dn, $rm, $add);
1652 - while (scalar @$ls == 0 && $dn ne File::Spec->curdir) {
1653 - sys(qw(svn rm --force),$dn);
1654 - $dir = basename $dn;
1655 - $dn = dirname $dn;
1656 - $rm->{ $dn }->{ $dir } = 1;
1657 - $ls = svn_ls_current($dn, $rm, $add);
1658 - }
1659 - }
1660 -}
1661 -
1222 sub get_commit_message {
1223 my ($commit, $commit_msg) = (@_);
1224 my %log_msg = ( msg => '' );
@@ -1704,56 +1264,6 @@ sub set_svn_commit_env {
1264 }
1265 }
1266
1707 -sub svn_commit_tree {
1708 - my ($last, $commit) = @_;
1709 - my $commit_msg = "$GIT_SVN_DIR/.svn-commit.tmp.$$";
1710 - my $log_msg = get_commit_message($commit, $commit_msg);
1711 - my ($oneline) = ($log_msg->{msg} =~ /([^\n\r]+)/);
1712 - print "Committing $commit: $oneline\n";
1713 -
1714 - set_svn_commit_env();
1715 - my @ci_output = safe_qx(qw(svn commit -F),$commit_msg);
1716 - $ENV{LC_ALL} = 'C';
1717 - unlink $commit_msg;
1718 - my ($committed) = ($ci_output[$#ci_output] =~ /(\d+)/);
1719 - if (!defined $committed) {
1720 - my $out = join("\n",@ci_output);
1721 - print STDERR "W: Trouble parsing \`svn commit' output:\n\n",
1722 - $out, "\n\nAssuming English locale...";
1723 - ($committed) = ($out =~ /^Committed revision \d+\./sm);
1724 - defined $committed or die " FAILED!\n",
1725 - "Commit output failed to parse committed revision!\n",
1726 - print STDERR " OK\n";
1727 - }
1728 -
1729 - my @svn_up = qw(svn up);
1730 - push @svn_up, '--ignore-externals' unless $_no_ignore_ext;
1731 - if ($_optimize_commits && ($committed == ($last->{revision} + 1))) {
1732 - push @svn_up, "-r$committed";
1733 - sys(@svn_up);
1734 - my $info = svn_info('.');
1735 - my $date = $info->{'Last Changed Date'} or die "Missing date\n";
1736 - if ($info->{'Last Changed Rev'} != $committed) {
1737 - croak "$info->{'Last Changed Rev'} != $committed\n"
1738 - }
1739 - my ($Y,$m,$d,$H,$M,$S,$tz) = ($date =~
1740 - /(\d{4})\-(\d\d)\-(\d\d)\s
1741 - (\d\d)\:(\d\d)\:(\d\d)\s([\-\+]\d+)/x)
1742 - or croak "Failed to parse date: $date\n";
1743 - $log_msg->{date} = "$tz $Y-$m-$d $H:$M:$S";
1744 - $log_msg->{author} = $info->{'Last Changed Author'};
1745 - $log_msg->{revision} = $committed;
1746 - $log_msg->{msg} .= "\n";
1747 - $log_msg->{parents} = [ $last->{commit} ];
1748 - $log_msg->{commit} = git_commit($log_msg, $commit);
1749 - return $log_msg;
1750 - }
1751 - # resync immediately
1752 - push @svn_up, "-r$last->{revision}";
1753 - sys(@svn_up);
1754 - return fetch("$committed=$commit");
1755 -}
1756 -
1267 sub rev_list_raw {
1268 my ($fh, $c) = command_output_pipe(qw/rev-list --pretty=raw/, @_);
1269 return { fh => $fh, ctx => $c, t => { } };
@@ -1782,177 +1292,6 @@ sub next_rev_list_entry {
1292 return ($x != $rl->{t}) ? $x : undef;
1293 }
1294
1785 -# read the entire log into a temporary file (which is removed ASAP)
1786 -# and store the file handle + parser state
1787 -sub svn_log_raw {
1788 - my (@log_args) = @_;
1789 - my $log_fh = IO::File->new_tmpfile or croak $!;
1790 - my $pid = fork;
1791 - defined $pid or croak $!;
1792 - if (!$pid) {
1793 - open STDOUT, '>&', $log_fh or croak $!;
1794 - exec (qw(svn log), @log_args) or croak $!
1795 - }
1796 - waitpid $pid, 0;
1797 - croak $? if $?;
1798 - seek $log_fh, 0, 0 or croak $!;
1799 - return { state => 'sep', fh => $log_fh };
1800 -}
1801 -
1802 -sub next_log_entry {
1803 - my $log = shift; # retval of svn_log_raw()
1804 - my $ret = undef;
1805 - my $fh = $log->{fh};
1806 -
1807 - while (<$fh>) {
1808 - chomp;
1809 - if (/^\-{72}$/) {
1810 - if ($log->{state} eq 'msg') {
1811 - if ($ret->{lines}) {
1812 - $ret->{msg} .= $_."\n";
1813 - unless(--$ret->{lines}) {
1814 - $log->{state} = 'sep';
1815 - }
1816 - } else {
1817 - croak "Log parse error at: $_\n",
1818 - $ret->{revision},
1819 - "\n";
1820 - }
1821 - next;
1822 - }
1823 - if ($log->{state} ne 'sep') {
1824 - croak "Log parse error at: $_\n",
1825 - "state: $log->{state}\n",
1826 - $ret->{revision},
1827 - "\n";
1828 - }
1829 - $log->{state} = 'rev';
1830 -
1831 - # if we have an empty log message, put something there:
1832 - if ($ret) {
1833 - $ret->{msg} ||= "\n";
1834 - delete $ret->{lines};
1835 - return $ret;
1836 - }
1837 - next;
1838 - }
1839 - if ($log->{state} eq 'rev' && s/^r(\d+)\s*\|\s*//) {
1840 - my $rev = $1;
1841 - my ($author, $date, $lines) = split(/\s*\|\s*/, $_, 3);
1842 - ($lines) = ($lines =~ /(\d+)/);
1843 - $date = '1970-01-01 00:00:00 +0000'
1844 - if ($_ignore_nodate && $date eq '(no date)');
1845 - my ($Y,$m,$d,$H,$M,$S,$tz) = ($date =~
1846 - /(\d{4})\-(\d\d)\-(\d\d)\s
1847 - (\d\d)\:(\d\d)\:(\d\d)\s([\-\+]\d+)/x)
1848 - or croak "Failed to parse date: $date\n";
1849 - $ret = { revision => $rev,
1850 - date => "$tz $Y-$m-$d $H:$M:$S",
1851 - author => $author,
1852 - lines => $lines,
1853 - msg => '' };
1854 - if (defined $_authors && ! defined $users{$author}) {
1855 - die "Author: $author not defined in ",
1856 - "$_authors file\n";
1857 - }
1858 - $log->{state} = 'msg_start';
1859 - next;
1860 - }
1861 - # skip the first blank line of the message:
1862 - if ($log->{state} eq 'msg_start' && /^$/) {
1863 - $log->{state} = 'msg';
1864 - } elsif ($log->{state} eq 'msg') {
1865 - if ($ret->{lines}) {
1866 - $ret->{msg} .= $_."\n";
1867 - unless (--$ret->{lines}) {
1868 - $log->{state} = 'sep';
1869 - }
1870 - } else {
1871 - croak "Log parse error at: $_\n",
1872 - $ret->{revision},"\n";
1873 - }
1874 - }
1875 - }
1876 - return $ret;
1877 -}
1878 -
1879 -sub svn_info {
1880 - my $url = shift || $SVN_URL;
1881 -
1882 - my $pid = open my $info_fh, '-|';
1883 - defined $pid or croak $!;
1884 -
1885 - if ($pid == 0) {
1886 - exec(qw(svn info),$url) or croak $!;
1887 - }
1888 -
1889 - my $ret = {};
1890 - # only single-lines seem to exist in svn info output
1891 - while (<$info_fh>) {
1892 - chomp $_;
1893 - if (m#^([^:]+)\s*:\s*(\S.*)$#) {
1894 - $ret->{$1} = $2;
1895 - push @{$ret->{-order}}, $1;
1896 - }
1897 - }
1898 - close $info_fh or croak $?;
1899 - return $ret;
1900 -}
1901 -
1902 -sub sys { system(@_) == 0 or croak $? }
1903 -
1904 -sub do_update_index {
1905 - my ($z_cmd, $cmd, $no_text_base) = @_;
1906 -
1907 - my ($p, $pctx) = command_output_pipe(@$z_cmd);
1908 -
1909 - my ($ui, $uctx) = command_input_pipe('update-index',
1910 - "--$cmd",'-z','--stdin');
1911 - local $/ = "\0";
1912 - while (my $x = <$p>) {
1913 - chomp $x;
1914 - if (!$no_text_base && lstat $x && ! -l _ &&
1915 - svn_propget_base('svn:keywords', $x)) {
1916 - my $mode = -x _ ? 0755 : 0644;
1917 - my ($v,$d,$f) = File::Spec->splitpath($x);
1918 - my $tb = File::Spec->catfile($d, '.svn', 'tmp',
1919 - 'text-base',"$f.svn-base");
1920 - $tb =~ s#^/##;
1921 - unless (-f $tb) {
1922 - $tb = File::Spec->catfile($d, '.svn',
1923 - 'text-base',"$f.svn-base");
1924 - $tb =~ s#^/##;
1925 - }
1926 - my @s = stat($x);
1927 - unlink $x or croak $!;
1928 - copy($tb, $x);
1929 - chmod(($mode &~ umask), $x) or croak $!;
1930 - utime $s[8], $s[9], $x;
1931 - }
1932 - print $ui $x,"\0";
1933 - }
1934 - command_close_pipe($p, $pctx);
1935 - command_close_pipe($ui, $uctx);
1936 -}
1937 -
1938 -sub index_changes {
1939 - return if $_use_lib;
1940 -
1941 - if (!-f "$GIT_SVN_DIR/info/exclude") {
1942 - open my $fd, '>>', "$GIT_SVN_DIR/info/exclude" or croak $!;
1943 - print $fd '.svn',"\n";
1944 - close $fd or croak $!;
1945 - }
1946 - my $no_text_base = shift;
1947 - do_update_index([qw/diff-files --name-only -z/],
1948 - 'remove',
1949 - $no_text_base);
1950 - do_update_index([qw/ls-files -z --others/,
1951 - "--exclude-from=$GIT_SVN_DIR/info/exclude"],
1952 - 'add',
1953 - $no_text_base);
1954 -}
1955 -
1295 sub s_to_file {
1296 my ($str, $file, $mode) = @_;
1297 open my $fd,'>',$file or croak $!;
@@ -1978,18 +1317,6 @@ sub assert_revision_unknown {
1317 }
1318 }
1319
1981 -sub trees_eq {
1982 - my ($x, $y) = @_;
1983 - my @x = command(qw/cat-file commit/,$x);
1984 - my @y = command(qw/cat-file commit/,$y);
1985 - if (($y[0] ne $x[0]) || $x[0] ne "tree $sha1"
1986 - || $y[0] ne "tree $sha1") {
1987 - print STDERR "Trees not equal: $y[0] != $x[0]\n";
1988 - return 0
1989 - }
1990 - return 1;
1991 -}
1992 -
1320 sub git_commit {
1321 my ($log_msg, @parents) = @_;
1322 assert_revision_unknown($log_msg->{revision});
@@ -2014,12 +1341,10 @@ sub git_commit {
1341 my $tree = $log_msg->{tree};
1342 if (!defined $tree) {
1343 my $index = set_index($GIT_SVN_INDEX);
2017 - index_changes();
1344 $tree = command_oneline('write-tree');
1345 croak $? if $?;
1346 restore_index($index);
1347 }
2022 -
1348 # just in case we clobber the existing ref, we still want that ref
1349 # as our parent:
1350 if (my $cur = verify_ref("refs/remotes/$GIT_SVN^0")) {
@@ -2104,102 +1429,6 @@ sub set_commit_env {
1429 $ENV{GIT_AUTHOR_DATE} = $ENV{GIT_COMMITTER_DATE} = $log_msg->{date};
1430 }
1431
2107 -sub apply_mod_line_blob {
2108 - my $m = shift;
2109 - if ($m->{mode_b} =~ /^120/) {
2110 - blob_to_symlink($m->{sha1_b}, $m->{file_b});
2111 - } else {
2112 - blob_to_file($m->{sha1_b}, $m->{file_b});
2113 - }
2114 -}
2115 -
2116 -sub blob_to_symlink {
2117 - my ($blob, $link) = @_;
2118 - defined $link or croak "\$link not defined!\n";
2119 - croak "Not a sha1: $blob\n" unless $blob =~ /^$sha1$/o;
2120 - if (-l $link || -f _) {
2121 - unlink $link or croak $!;
2122 - }
2123 -
2124 - my $dest = `git-cat-file blob $blob`; # no newline, so no chomp
2125 - symlink $dest, $link or croak $!;
2126 -}
2127 -
2128 -sub blob_to_file {
2129 - my ($blob, $file) = @_;
2130 - defined $file or croak "\$file not defined!\n";
2131 - croak "Not a sha1: $blob\n" unless $blob =~ /^$sha1$/o;
2132 - if (-l $file || -f _) {
2133 - unlink $file or croak $!;
2134 - }
2135 -
2136 - open my $blob_fh, '>', $file or croak "$!: $file\n";
2137 - my $pid = fork;
2138 - defined $pid or croak $!;
2139 -
2140 - if ($pid == 0) {
2141 - open STDOUT, '>&', $blob_fh or croak $!;
2142 - exec('git-cat-file','blob',$blob) or croak $!;
2143 - }
2144 - waitpid $pid, 0;
2145 - croak $? if $?;
2146 -
2147 - close $blob_fh or croak $!;
2148 -}
2149 -
2150 -sub safe_qx {
2151 - my $pid = open my $child, '-|';
2152 - defined $pid or croak $!;
2153 - if ($pid == 0) {
2154 - exec(@_) or croak $!;
2155 - }
2156 - my @ret = (<$child>);
2157 - close $child or croak $?;
2158 - die $? if $?; # just in case close didn't error out
2159 - return wantarray ? @ret : join('',@ret);
2160 -}
2161 -
2162 -sub svn_compat_check {
2163 - if ($_follow_parent) {
2164 - print STDERR 'E: --follow-parent functionality is only ',
2165 - "available when SVN libraries are used\n";
2166 - exit 1;
2167 - }
2168 - my @co_help = safe_qx(qw(svn co -h));
2169 - unless (grep /ignore-externals/,@co_help) {
2170 - print STDERR "W: Installed svn version does not support ",
2171 - "--ignore-externals\n";
2172 - $_no_ignore_ext = 1;
2173 - }
2174 - if (grep /usage: checkout URL\[\@REV\]/,@co_help) {
2175 - $_svn_co_url_revs = 1;
2176 - }
2177 - if (grep /\[TARGET\[\@REV\]\.\.\.\]/, `svn propget -h`) {
2178 - $_svn_pg_peg_revs = 1;
2179 - }
2180 -
2181 - # I really, really hope nobody hits this...
2182 - unless (grep /stop-on-copy/, (safe_qx(qw(svn log -h)))) {
2183 - print STDERR <<'';
2184 -W: The installed svn version does not support the --stop-on-copy flag in
2185 - the log command.
2186 - Lets hope the directory you're tracking is not a branch or tag
2187 - and was never moved within the repository...
2188 -
2189 - $_no_stop_copy = 1;
2190 - }
2191 -}
2192 -
2193 -# *sigh*, new versions of svn won't honor -r<rev> without URL@<rev>,
2194 -# (and they won't honor URL@<rev> without -r<rev>, too!)
2195 -sub svn_cmd_checkout {
2196 - my ($url, $rev, $dir) = @_;
2197 - my @cmd = ('svn','co', "-r$rev");
2198 - push @cmd, '--ignore-externals' unless $_no_ignore_ext;
2199 - $url .= "\@$rev" if $_svn_co_url_revs;
2200 - sys(@cmd, $url, $dir);
2201 -}
2202 -
1432 sub check_upgrade_needed {
1433 if (!-r $REVDB) {
1434 -d $GIT_SVN_DIR or mkpath([$GIT_SVN_DIR]);
@@ -2277,12 +1506,6 @@ sub rload_authors {
1506 close $authors or croak $!;
1507 }
1508
2280 -sub svn_propget_base {
2281 - my ($p, $f) = @_;
2282 - $f .= '@BASE' if $_svn_pg_peg_revs;
2283 - return safe_qx(qw/svn propget/, $p, $f);
2284 -}
2285 -
1509 sub git_svn_each {
1510 my $sub = shift;
1511 foreach (command(qw/rev-parse --symbolic --all/)) {
@@ -2682,33 +1905,6 @@ sub show_commit_normal {
1905 }
1906 }
1907
2685 -sub libsvn_load {
2686 - return unless $_use_lib;
2687 - $_use_lib = eval {
2688 - require SVN::Core;
2689 - if ($SVN::Core::VERSION lt '1.1.0') {
2690 - die "Need SVN::Core 1.1.0 or better ",
2691 - "(got $SVN::Core::VERSION) ",
2692 - "Falling back to command-line svn\n";
2693 - }
2694 - require SVN::Ra;
2695 - require SVN::Delta;
2696 - push @SVN::Git::Editor::ISA, 'SVN::Delta::Editor';
2697 - push @SVN::Git::Fetcher::ISA, 'SVN::Delta::Editor';
2698 - *SVN::Git::Fetcher::process_rm = *process_rm;
2699 - my $kill_stupid_warnings = $SVN::Node::none.$SVN::Node::file.
2700 - $SVN::Node::dir.$SVN::Node::unknown.
2701 - $SVN::Node::none.$SVN::Node::file.
2702 - $SVN::Node::dir.$SVN::Node::unknown.
2703 - $SVN::Auth::SSL::CNMISMATCH.
2704 - $SVN::Auth::SSL::NOTYETVALID.
2705 - $SVN::Auth::SSL::EXPIRED.
2706 - $SVN::Auth::SSL::UNKNOWNCA.
2707 - $SVN::Auth::SSL::OTHER;
2708 - 1;
2709 - };
2710 -}
2711 -
1908 sub _simple_prompt {
1909 my ($cred, $realm, $default_username, $may_save, $pool) = @_;
1910 $may_save = undef if $_no_auth_cache;
@@ -3231,18 +2427,11 @@ sub revisions_eq {
2427 my ($path, $r0, $r1) = @_;
2428 return 1 if $r0 == $r1;
2429 my $nr = 0;
3234 - if ($_use_lib) {
3235 - # should be OK to use Pool here (r1 - r0) should be small
3236 - my $pool = SVN::Pool->new;
3237 - libsvn_get_log($SVN, [$path], $r0, $r1,
3238 - 0, 0, 1, sub {$nr++}, $pool);
3239 - $pool->clear;
3240 - } else {
3241 - my ($url, undef) = repo_path_split($SVN_URL);
3242 - my $svn_log = svn_log_raw("$url/$path","-r$r0:$r1");
3243 - while (next_log_entry($svn_log)) { $nr++ }
3244 - close $svn_log->{fh};
3245 - }
2430 + # should be OK to use Pool here (r1 - r0) should be small
2431 + my $pool = SVN::Pool->new;
2432 + libsvn_get_log($SVN, [$path], $r0, $r1,
2433 + 0, 0, 1, sub {$nr++}, $pool);
2434 + $pool->clear;
2435 return 0 if ($nr > 1);
2436 return 1;
2437 }
@@ -3526,6 +2715,19 @@ sub copy_remote_ref {
2715 "refs/remotes/$GIT_SVN on $origin\n";
2716 }
2717 }
2718 +
2719 +{
2720 + my $kill_stupid_warnings = $SVN::Node::none.$SVN::Node::file.
2721 + $SVN::Node::dir.$SVN::Node::unknown.
2722 + $SVN::Node::none.$SVN::Node::file.
2723 + $SVN::Node::dir.$SVN::Node::unknown.
2724 + $SVN::Auth::SSL::CNMISMATCH.
2725 + $SVN::Auth::SSL::NOTYETVALID.
2726 + $SVN::Auth::SSL::EXPIRED.
2727 + $SVN::Auth::SSL::UNKNOWNCA.
2728 + $SVN::Auth::SSL::OTHER;
2729 +}
2730 +
2731 package SVN::Git::Fetcher;
2732 use vars qw/@ISA/;
2733 use strict;
@@ -3963,13 +3165,7 @@ __END__
3165
3166 Data structures:
3167
3966 -$svn_log hashref (as returned by svn_log_raw)
3967 -{
3968 - fh => file handle of the log file,
3969 - state => state of the log file parser (sep/msg/rev/msg_start...)
3970 -}
3971 -
3972 -$log_msg hashref as returned by next_log_entry($svn_log)
3168 +$log_msg hashref as returned by libsvn_log_entry()
3169 {
3170 msg => 'whitespace-formatted log entry
3171 ', # trailing newline is preserved
@@ -3978,7 +3174,6 @@ $log_msg hashref as returned by next_log_entry($svn_log)
3174 author => 'committer name'
3175 };
3176
3981 -
3177 @mods = array of diff-index line hashes, each element represents one line
3178 of diff-index output
3179
t/Makefile
+3 -7
@@ -23,13 +23,9 @@ clean:
23
24 # we can test NO_OPTIMIZE_COMMITS independently of LC_ALL
25 full-svn-test:
26 - $(MAKE) $(TSVN) GIT_SVN_NO_LIB=0 GIT_SVN_DELTA_FETCH=1 \
27 - GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
28 - $(MAKE) $(TSVN) GIT_SVN_NO_LIB=1 GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
29 - $(MAKE) $(TSVN) GIT_SVN_NO_LIB=1 GIT_SVN_NO_OPTIMIZE_COMMITS=0 \
30 - LC_ALL=en_US.UTF-8
31 - $(MAKE) $(TSVN) GIT_SVN_NO_LIB=0 GIT_SVN_NO_OPTIMIZE_COMMITS=0 \
32 - LC_ALL=en_US.UTF-8
26 + $(MAKE) $(TSVN) GIT_SVN_DELTA_FETCH=1 \
27 + GIT_SVN_NO_OPTIMIZE_COMMITS=1 LC_ALL=C
28 + $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8
29
30 .PHONY: $(T) clean
31 .NOTPARALLEL:
t/lib-git-svn.sh
+8 -7
@@ -7,17 +7,18 @@ then
7 exit
8 fi
9
10 -GIT_DIR=$PWD/.git
11 -GIT_SVN_DIR=$GIT_DIR/svn/git-svn
12 -SVN_TREE=$GIT_SVN_DIR/svn-tree
13 -
14 -perl -e 'use SVN::Core' >/dev/null 2>&1
10 +perl -e 'use SVN::Core; $SVN::Core::VERSION gt "1.1.0" or die' >/dev/null 2>&1
11 if test $? -ne 0
12 then
17 - echo 'Perl SVN libraries not found, tests requiring those will be skipped'
18 - GIT_SVN_NO_LIB=1
13 + test_expect_success 'Perl SVN libraries not found, skipping test' :
14 + test_done
15 + exit
16 fi
17
18 +GIT_DIR=$PWD/.git
19 +GIT_SVN_DIR=$GIT_DIR/svn/git-svn
20 +SVN_TREE=$GIT_SVN_DIR/svn-tree
21 +
22 svnadmin >/dev/null 2>&1
23 if test $? -ne 1
24 then
t/t9100-git-svn-basic.sh
+1 -3
@@ -229,9 +229,7 @@ tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e
229 tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4
230 EOF
231
232 -if test -z "$GIT_SVN_NO_LIB" || test "$GIT_SVN_NO_LIB" -eq 0; then
233 - echo tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 >> expected
234 -fi
232 +echo tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 >> expected
233
234 test_expect_success "$name" "diff -u a expected"
235
t/t9104-git-svn-follow-parent.sh
-7
@@ -6,13 +6,6 @@
6 test_description='git-svn --follow-parent fetching'
7 . ./lib-git-svn.sh
8
9 -if test -n "$GIT_SVN_NO_LIB" && test "$GIT_SVN_NO_LIB" -ne 0
10 -then
11 - echo 'Skipping: --follow-parent needs SVN libraries'
12 - test_done
13 - exit 0
14 -fi
15 -
9 test_expect_success 'initialize repo' "
10 mkdir import &&
11 cd import &&
t/t9105-git-svn-commit-diff.sh
-7
@@ -4,13 +4,6 @@
4 test_description='git-svn commit-diff'
5 . ./lib-git-svn.sh
6
7 -if test -n "$GIT_SVN_NO_LIB" && test "$GIT_SVN_NO_LIB" -ne 0
8 -then
9 - echo 'Skipping: commit-diff needs SVN libraries'
10 - test_done
11 - exit 0
12 -fi
13 -
7 test_expect_success 'initialize repo' "
8 mkdir import &&
9 cd import &&
t/t9106-git-svn-commit-diff-clobber.sh
-7
@@ -4,13 +4,6 @@
4 test_description='git-svn commit-diff clobber'
5 . ./lib-git-svn.sh
6
7 -if test -n "$GIT_SVN_NO_LIB" && test "$GIT_SVN_NO_LIB" -ne 0
8 -then
9 - echo 'Skipping: commit-diff clobber needs SVN libraries'
10 - test_done
11 - exit 0
12 -fi
13 -
7 test_expect_success 'initialize repo' "
8 mkdir import &&
9 cd import &&