Skip to content

Commit b1ea6c3

Browse files
schwernEric Wong
authored andcommitted
use Git::SVN{,::RA}->url accessor globally
Note: The structure returned from Git::SVN->read_all_remotes() does not appear to contain objects, so I'm leaving them alone. That's everything converted over to the url and path accessors. No functional change. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
1 parent 6a8d999 commit b1ea6c3

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

git-svn.perl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ sub cmd_commit_diff {
13951395
fatal("Needed URL or usable git-svn --id in ",
13961396
"the command-line\n", $usage);
13971397
}
1398-
$url = $gs->{url};
1398+
$url = $gs->url;
13991399
$svn_path = $gs->path;
14001400
}
14011401
unless (defined $_revision) {
@@ -1663,15 +1663,16 @@ sub complete_url_ls_init {
16631663
"and a separate URL is not specified");
16641664
}
16651665
}
1666-
my $url = $ra->{url};
1666+
my $url = $ra->url;
16671667
my $gs = Git::SVN->init($url, undef, undef, undef, 1);
16681668
my $k = "svn-remote.$gs->{repo_id}.url";
16691669
my $orig_url = eval { command_oneline(qw/config --get/, $k) };
1670-
if ($orig_url && ($orig_url ne $gs->{url})) {
1670+
if ($orig_url && ($orig_url ne $gs->url)) {
16711671
die "$k already set: $orig_url\n",
1672-
"wanted to set to: $gs->{url}\n";
1672+
"wanted to set to: $gs->url\n";
16731673
}
1674-
command_oneline('config', $k, $gs->{url}) unless $orig_url;
1674+
command_oneline('config', $k, $gs->url) unless $orig_url;
1675+
16751676
my $remote_path = $gs->path . "/$repo_path";
16761677
$remote_path =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;
16771678
$remote_path =~ s#/+#/#g;

perl/Git/SVN.pm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ sub _set_svm_vars {
560560
# username is of no interest
561561
$src =~ s{(^[a-z\+]*://)[^/@]*@}{$1};
562562

563-
my $replace = $ra->{url};
563+
my $replace = $ra->url;
564564
$replace .= "/$path" if length $path;
565565

566566
my $section = "svn-remote.$self->{repo_id}";
@@ -599,16 +599,17 @@ sub _set_svm_vars {
599599
$path = $ra->{svn_path};
600600
$ra = Git::SVN::Ra->new($ra->{repos_root});
601601
while (length $path) {
602-
unless ($tried{"$ra->{url}/$path"}) {
602+
my $try = $ra->url ."/$path";
603+
unless ($tried{$try}) {
603604
$ok = $self->read_svm_props($ra, $path, $r);
604605
last if $ok;
605-
$tried{"$ra->{url}/$path"} = 1;
606+
$tried{$try} = 1;
606607
}
607608
$path =~ s#/?[^/]+$##;
608609
}
609610
die "Path: '$path' should be ''\n" if $path ne '';
610611
$ok ||= $self->read_svm_props($ra, $path, $r);
611-
$tried{"$ra->{url}/$path"} = 1;
612+
$tried{$ra->url ."/$path"} = 1;
612613
if (!$ok) {
613614
die @err, (map { " $_\n" } keys %tried), "\n";
614615
}
@@ -1108,7 +1109,7 @@ sub find_parent_branch {
11081109
}
11091110
my $r = $i->{copyfrom_rev};
11101111
my $repos_root = $self->ra->{repos_root};
1111-
my $url = $self->ra->{url};
1112+
my $url = $self->ra->url;
11121113
my $new_url = $url . $branch_from;
11131114
print STDERR "Found possible branch point: ",
11141115
"$new_url => ", $self->full_url, ", $r\n"

perl/Git/SVN/Migration.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,14 @@ sub minimize_connections {
177177
my $ra = Git::SVN::Ra->new($url);
178178

179179
# skip existing cases where we already connect to the root
180-
if (($ra->{url} eq $ra->{repos_root}) ||
180+
if (($ra->url eq $ra->{repos_root}) ||
181181
($ra->{repos_root} eq $repo_id)) {
182-
$root_repos->{$ra->{url}} = $repo_id;
182+
$root_repos->{$ra->url} = $repo_id;
183183
next;
184184
}
185185

186186
my $root_ra = Git::SVN::Ra->new($ra->{repos_root});
187-
my $root_path = $ra->{url};
187+
my $root_path = $ra->url;
188188
$root_path =~ s#^\Q$ra->{repos_root}\E(/|$)##;
189189
foreach my $path (keys %$fetch) {
190190
my $ref_id = $fetch->{$path};

0 commit comments

Comments
 (0)