use Git::SVN->path accessor globally
No functional change. [ew: commit title] Signed-off-by: Eric Wong <normalperson@yhbt.net>
Michael G. Schwern committed
Jul 27, 2012 at 13:00 UTC
6a8d999ed4a0030ab7902382ed3b122ce448e581
4 files changed
+13
-11
git-svn.perl
+7
-5
@@ -1195,7 +1195,7 @@ sub cmd_show_ignore {
1195
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
1196
$gs ||= Git::SVN->new;
1197
my $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);
1198
- $gs->prop_walk($gs->{path}, $r, sub {
1198
+ $gs->prop_walk($gs->path, $r, sub {
1199
my ($gs, $path, $props) = @_;
1200
print STDOUT "\n# $path\n";
1201
my $s = $props->{'svn:ignore'} or return;
@@ -1211,7 +1211,7 @@ sub cmd_show_externals {
1211
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
1212
$gs ||= Git::SVN->new;
1213
my $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);
1214
- $gs->prop_walk($gs->{path}, $r, sub {
1214
+ $gs->prop_walk($gs->path, $r, sub {
1215
my ($gs, $path, $props) = @_;
1216
print STDOUT "\n# $path\n";
1217
my $s = $props->{'svn:externals'} or return;
@@ -1226,7 +1226,7 @@ sub cmd_create_ignore {
1226
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
1227
$gs ||= Git::SVN->new;
1228
my $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);
1229
- $gs->prop_walk($gs->{path}, $r, sub {
1229
+ $gs->prop_walk($gs->path, $r, sub {
1230
my ($gs, $path, $props) = @_;
1231
# $path is of the form /path/to/dir/
1232
$path = '.' . $path;
@@ -1396,7 +1396,7 @@ sub cmd_commit_diff {
1396
"the command-line\n", $usage);
1397
}
1398
$url = $gs->{url};
1399
- $svn_path = $gs->{path};
1399
+ $svn_path = $gs->path;
1400
}
1401
unless (defined $_revision) {
1402
fatal("-r|--revision is a required argument\n", $usage);
@@ -1634,6 +1634,8 @@ sub post_fetch_checkout {
1634
sub complete_svn_url {
1635
my ($url, $path) = @_;
1636
$path =~ s#/+$##;
1637
+
1638
+ # If the path is not a URL...
1639
if ($path !~ m#^[a-z\+]+://#) {
1640
if (!defined $url || $url !~ m#^[a-z\+]+://#) {
1641
fatal("E: '$path' is not a complete URL ",
@@ -1670,7 +1672,7 @@ sub complete_url_ls_init {
1672
"wanted to set to: $gs->{url}\n";
1673
}
1674
command_oneline('config', $k, $gs->{url}) unless $orig_url;
1673
- my $remote_path = "$gs->{path}/$repo_path";
1675
+ my $remote_path = $gs->path . "/$repo_path";
1676
$remote_path =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;
1677
$remote_path =~ s#/+#/#g;
1678
$remote_path =~ s#^/##g;
perl/Git/SVN.pm
+2
-2
@@ -1123,7 +1123,7 @@ sub find_parent_branch {
1123
($base, $head) = parse_revision_argument(0, $r);
1124
} else {
1125
if ($r0 < $r) {
1126
- $gs->ra->get_log([$gs->{path}], $r0 + 1, $r, 1,
1126
+ $gs->ra->get_log([$gs->path], $r0 + 1, $r, 1,
1127
0, 1, sub { $base = $_[1] - 1 });
1128
}
1129
}
@@ -1145,7 +1145,7 @@ sub find_parent_branch {
1145
# at the moment), so we can't rely on it
1146
$self->{last_rev} = $r0;
1147
$self->{last_commit} = $parent;
1148
- $ed = Git::SVN::Fetcher->new($self, $gs->{path});
1148
+ $ed = Git::SVN::Fetcher->new($self, $gs->path);
1149
$gs->ra->gs_do_switch($r0, $rev, $gs,
1150
$self->full_url, $ed)
1151
or die "SVN connection failed somewhere...\n";
perl/Git/SVN/Fetcher.pm
+1
-1
@@ -83,7 +83,7 @@ sub _mark_empty_symlinks {
83
chomp(my $empty_blob = `git hash-object -t blob --stdin < /dev/null`);
84
my ($ls, $ctx) = command_output_pipe(qw/ls-tree -r -z/, $cmt);
85
local $/ = "\0";
86
- my $pfx = defined($switch_path) ? $switch_path : $git_svn->{path};
86
+ my $pfx = defined($switch_path) ? $switch_path : $git_svn->path;
87
$pfx .= '/' if length($pfx);
88
while (<$ls>) {
89
chomp;
perl/Git/SVN/Ra.pm
+3
-3
@@ -262,7 +262,7 @@ sub get_commit_editor {
262
sub gs_do_update {
263
my ($self, $rev_a, $rev_b, $gs, $editor) = @_;
264
my $new = ($rev_a == $rev_b);
265
- my $path = $gs->{path};
265
+ my $path = $gs->path;
266
267
if ($new && -e $gs->{index}) {
268
unlink $gs->{index} or die
@@ -298,7 +298,7 @@ sub gs_do_update {
298
# svn_ra_reparent didn't work before 1.4)
299
sub gs_do_switch {
300
my ($self, $rev_a, $rev_b, $gs, $url_b, $editor) = @_;
301
- my $path = $gs->{path};
301
+ my $path = $gs->path;
302
my $pool = SVN::Pool->new;
303
304
my $full_url = $self->url;
@@ -342,7 +342,7 @@ sub longest_common_path {
342
my $common_max = scalar @$gsv;
343
344
foreach my $gs (@$gsv) {
345
- my @tmp = split m#/#, $gs->{path};
345
+ my @tmp = split m#/#, $gs->path;
346
my $p = '';
347
foreach (@tmp) {
348
$p .= length($p) ? "/$_" : $_;