$_version, $_upgrade, $_authors, $_branch_all_refs, @_opt_m,
$_merge, $_strategy, $_dry_run, $_ignore_nodate, $_non_recursive,
$_username, $_config_dir, $_no_auth_cache,
- $_pager, $_color);
+ $_pager, $_color, $_prefix);
my (@_branch_from, %tree_map, %users, %rusers, %equiv);
my ($_svn_can_do_switch);
my @repo_path_split_cache;
);
my %cmd = (
- fetch => [ \&fetch, "Download new revisions from SVN",
+ fetch => [ \&cmd_fetch, "Download new revisions from SVN",
{ 'revision|r=s' => \$_revision, %fc_opts } ],
init => [ \&init, "Initialize a repo for tracking" .
" (requires URL argument)",
'username=s' => \$_username,
'config-dir=s' => \$_config_dir,
'no-auth-cache' => \$_no_auth_cache,
+ 'prefix=s' => \$_prefix,
} ],
'multi-fetch' => [ \&multi_fetch,
'Fetch multiple trees (like git-svnimport)',
$SVN_URL = $url;
unless (-d $GIT_DIR) {
- my @init_db = ('init-db');
+ my @init_db = ('init');
push @init_db, "--template=$_template" if defined $_template;
push @init_db, "--shared" if defined $_shared;
command_noisy(@init_db);
setup_git_svn();
}
+sub cmd_fetch {
+ fetch_child_id($GIT_SVN, @_);
+}
+
sub fetch {
check_upgrade_needed();
$SVN_URL ||= file_to_s("$GIT_SVN_DIR/info/url");
my $repo;
$SVN ||= libsvn_connect($SVN_URL);
my $r = defined $_revision ? $_revision : $SVN->get_latest_revnum;
- libsvn_traverse_ignore(\*STDOUT, $SVN->{svn_path}, $r);
+ libsvn_traverse_ignore(\*STDOUT, '', $r);
}
sub graft_branches {
command_noisy('repo-config', 'svn.trunk', $trunk_url);
}
}
- complete_url_ls_init($url, $_branches, '--branches/-b', '');
- complete_url_ls_init($url, $_tags, '--tags/-t', 'tags/');
+ $_prefix = '' unless defined $_prefix;
+ complete_url_ls_init($url, $_branches, '--branches/-b', $_prefix);
+ complete_url_ls_init($url, $_tags, '--tags/-t', $_prefix . 'tags/');
}
sub multi_fetch {
my $ref = "$GIT_DIR/refs/remotes/$id";
defined(my $pid = open my $fh, '-|') or croak $!;
if (!$pid) {
- $_repack = undef;
$GIT_SVN = $ENV{GIT_SVN_ID} = $id;
init_vars();
fetch(@_);
}
while (<$fh>) {
print $_;
- check_repack() if (/^r\d+ = $sha1/);
+ check_repack() if (/^r\d+ = $sha1/o);
}
close $fh or croak $?;
}
my ($grafts, $l_map, $u, $p, @re) = @_;
my $x = $l_map->{$u}->{$p};
- my $rl = rev_list_raw($x);
+ my $rl = rev_list_raw("refs/remotes/$x");
while (my $c = next_rev_list_entry($rl)) {
foreach my $re (@re) {
my (@br) = ($c->{m} =~ /$re/g);
# this output is read via pipe, do not change:
print "r$log_msg->{revision} = $commit\n";
- check_repack();
return $commit;
}