summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8164b65)
raw | patch | inline | side by side (parent: 8164b65)
author | Eric Wong <normalperson@yhbt.net> | |
Fri, 12 Jan 2007 01:09:26 +0000 (17:09 -0800) | ||
committer | Eric Wong <normalperson@yhbt.net> | |
Fri, 23 Feb 2007 08:57:08 +0000 (00:57 -0800) |
If a user specified a seperate URL and --tags/--branches as
a sepearte URL, allow the Ra object (and therefore the connection)
to be reused.
We'll get rid of libsvn_ls_fullurl() since it was only used
in one place.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
a sepearte URL, allow the Ra object (and therefore the connection)
to be reused.
We'll get rid of libsvn_ls_fullurl() since it was only used
in one place.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn.perl | patch | blob | history | |
t/t9103-git-svn-graft-branches.sh | patch | blob | history |
diff --git a/git-svn.perl b/git-svn.perl
index 72f73ea623ddb58e3d9d68d519e7fa6ed4fb7891..02786f1a6acc0c8b6cc8c276df9573e35a4db088 100755 (executable)
--- a/git-svn.perl
+++ b/git-svn.perl
command_noisy('config', 'svn.trunk', $trunk_url);
}
}
- complete_url_ls_init($url, $_branches, '--branches/-b', $_prefix);
- complete_url_ls_init($url, $_tags, '--tags/-t', $_prefix . 'tags/');
+ my $ra = $url ? Git::SVN::Ra->new($url) : undef;
+ complete_url_ls_init($ra, $_branches, '--branches/-b', $_prefix);
+ complete_url_ls_init($ra, $_tags, '--tags/-t', $_prefix . 'tags/');
}
sub multi_fetch {
}
sub complete_url_ls_init {
- my ($url, $path, $switch, $pfx) = @_;
+ my ($ra, $path, $switch, $pfx) = @_;
unless ($path) {
print STDERR "W: $switch not specified\n";
return;
}
- my $full_url = complete_svn_url($url, $path);
- my @ls = libsvn_ls_fullurl($full_url);
- foreach my $u (map { "$full_url/$_" } (grep m!/$!, @ls)) {
- $u =~ s#/+$##;
- if ($u !~ m!\Q$full_url\E/(.+)$!) {
- print STDERR "W: Unrecognized URL: $u\n";
- die "This should never happen\n";
+ $path =~ s#/+$##;
+ if ($path =~ m#^[a-z\+]+://#) {
+ $ra = Git::SVN::Ra->new($path);
+ $path = '';
+ } else {
+ $path =~ s#^/+##;
+ unless ($ra) {
+ fatal("E: '$path' is not a complete URL ",
+ "and a separate URL is not specified\n");
}
- # don't try to init already existing refs
- my $id = $pfx.$1;
+ }
+ my $r = defined $_revision ? $_revision : $ra->get_latest_revnum;
+ my ($dirent, undef, undef) = $ra->get_dir($path, $r);
+ my $url = $ra->{url} . (length $path ? "/$path" : '');
+ foreach my $d (sort keys %$dirent) {
+ next if ($dirent->{$d}->kind != $SVN::Node::dir);
+ my $u = "$url/$d";
+ my $id = "$pfx$d";
my $gs = eval { Git::SVN->new($id) };
+ # don't try to init already existing refs
unless ($gs) {
print "init $u => $id\n";
Git::SVN->init($id, $u);
}
}
my ($n) = ($switch =~ /^--(\w+)/);
- command_noisy('config', "svn.$n", $full_url);
+ command_noisy('config', "svn.$n", $url);
}
sub common_prefix {
}
}
-sub libsvn_ls_fullurl {
- my $fullurl = shift;
- my $ra = Git::SVN::Ra->new($fullurl);
- my @ret;
- my $r = defined $_revision ? $_revision : $ra->get_latest_revnum;
- my ($dirent, undef, undef) = $ra->get_dir('', $r);
- foreach my $d (sort keys %$dirent) {
- if ($dirent->{$d}->kind == $SVN::Node::dir) {
- push @ret, "$d/"; # add '/' for compat with cli svn
- }
- }
- return @ret;
-}
-
sub libsvn_skip_unknown_revs {
my $err = shift;
my $errno = $err->apr_err();
index 183ae3b1c2f0511810c18418c109a2e1412fa8a8..8d946d2aa52135e55c196a42da113cecf1d3e506 100755 (executable)
git-svn multi-fetch
"
+test_expect_success 'multi-init set .git/config correctly' "
+ test '$svnrepo/trunk' = '`git repo-config --get svn.trunk`' &&
+ test '$svnrepo/branches' = '`git repo-config --get svn.branches`' &&
+ test '$svnrepo/tags' = '`git repo-config --get svn.tags`'
+ "
+
r1=`git-rev-list remotes/trunk | tail -n1`
r2=`git-rev-list remotes/tags/a | tail -n1`
r3=`git-rev-list remotes/a | tail -n1`