use Git::SVN->path accessor globally

No functional change.

[ew: commit title]

Signed-off-by: Eric Wong <normalperson@yhbt.net>
This commit is contained in:
Michael G. Schwern 2012-07-27 13:00:51 -07:00 committed by Eric Wong
parent b4943dc963
commit 6a8d999ed4
4 changed files with 13 additions and 11 deletions

View File

@ -1195,7 +1195,7 @@ sub cmd_show_ignore {
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD'); my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
$gs ||= Git::SVN->new; $gs ||= Git::SVN->new;
my $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum); my $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);
$gs->prop_walk($gs->{path}, $r, sub { $gs->prop_walk($gs->path, $r, sub {
my ($gs, $path, $props) = @_; my ($gs, $path, $props) = @_;
print STDOUT "\n# $path\n"; print STDOUT "\n# $path\n";
my $s = $props->{'svn:ignore'} or return; my $s = $props->{'svn:ignore'} or return;
@ -1211,7 +1211,7 @@ sub cmd_show_externals {
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD'); my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
$gs ||= Git::SVN->new; $gs ||= Git::SVN->new;
my $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum); my $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);
$gs->prop_walk($gs->{path}, $r, sub { $gs->prop_walk($gs->path, $r, sub {
my ($gs, $path, $props) = @_; my ($gs, $path, $props) = @_;
print STDOUT "\n# $path\n"; print STDOUT "\n# $path\n";
my $s = $props->{'svn:externals'} or return; my $s = $props->{'svn:externals'} or return;
@ -1226,7 +1226,7 @@ sub cmd_create_ignore {
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD'); my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
$gs ||= Git::SVN->new; $gs ||= Git::SVN->new;
my $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum); my $r = (defined $_revision ? $_revision : $gs->ra->get_latest_revnum);
$gs->prop_walk($gs->{path}, $r, sub { $gs->prop_walk($gs->path, $r, sub {
my ($gs, $path, $props) = @_; my ($gs, $path, $props) = @_;
# $path is of the form /path/to/dir/ # $path is of the form /path/to/dir/
$path = '.' . $path; $path = '.' . $path;
@ -1396,7 +1396,7 @@ sub cmd_commit_diff {
"the command-line\n", $usage); "the command-line\n", $usage);
} }
$url = $gs->{url}; $url = $gs->{url};
$svn_path = $gs->{path}; $svn_path = $gs->path;
} }
unless (defined $_revision) { unless (defined $_revision) {
fatal("-r|--revision is a required argument\n", $usage); fatal("-r|--revision is a required argument\n", $usage);
@ -1634,6 +1634,8 @@ sub post_fetch_checkout {
sub complete_svn_url { sub complete_svn_url {
my ($url, $path) = @_; my ($url, $path) = @_;
$path =~ s#/+$##; $path =~ s#/+$##;
# If the path is not a URL...
if ($path !~ m#^[a-z\+]+://#) { if ($path !~ m#^[a-z\+]+://#) {
if (!defined $url || $url !~ m#^[a-z\+]+://#) { if (!defined $url || $url !~ m#^[a-z\+]+://#) {
fatal("E: '$path' is not a complete URL ", fatal("E: '$path' is not a complete URL ",
@ -1670,7 +1672,7 @@ sub complete_url_ls_init {
"wanted to set to: $gs->{url}\n"; "wanted to set to: $gs->{url}\n";
} }
command_oneline('config', $k, $gs->{url}) unless $orig_url; command_oneline('config', $k, $gs->{url}) unless $orig_url;
my $remote_path = "$gs->{path}/$repo_path"; my $remote_path = $gs->path . "/$repo_path";
$remote_path =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg; $remote_path =~ s{%([0-9A-F]{2})}{chr hex($1)}ieg;
$remote_path =~ s#/+#/#g; $remote_path =~ s#/+#/#g;
$remote_path =~ s#^/##g; $remote_path =~ s#^/##g;

View File

@ -1123,7 +1123,7 @@ sub find_parent_branch {
($base, $head) = parse_revision_argument(0, $r); ($base, $head) = parse_revision_argument(0, $r);
} else { } else {
if ($r0 < $r) { if ($r0 < $r) {
$gs->ra->get_log([$gs->{path}], $r0 + 1, $r, 1, $gs->ra->get_log([$gs->path], $r0 + 1, $r, 1,
0, 1, sub { $base = $_[1] - 1 }); 0, 1, sub { $base = $_[1] - 1 });
} }
} }
@ -1145,7 +1145,7 @@ sub find_parent_branch {
# at the moment), so we can't rely on it # at the moment), so we can't rely on it
$self->{last_rev} = $r0; $self->{last_rev} = $r0;
$self->{last_commit} = $parent; $self->{last_commit} = $parent;
$ed = Git::SVN::Fetcher->new($self, $gs->{path}); $ed = Git::SVN::Fetcher->new($self, $gs->path);
$gs->ra->gs_do_switch($r0, $rev, $gs, $gs->ra->gs_do_switch($r0, $rev, $gs,
$self->full_url, $ed) $self->full_url, $ed)
or die "SVN connection failed somewhere...\n"; or die "SVN connection failed somewhere...\n";

View File

@ -83,7 +83,7 @@ sub _mark_empty_symlinks {
chomp(my $empty_blob = `git hash-object -t blob --stdin < /dev/null`); chomp(my $empty_blob = `git hash-object -t blob --stdin < /dev/null`);
my ($ls, $ctx) = command_output_pipe(qw/ls-tree -r -z/, $cmt); my ($ls, $ctx) = command_output_pipe(qw/ls-tree -r -z/, $cmt);
local $/ = "\0"; local $/ = "\0";
my $pfx = defined($switch_path) ? $switch_path : $git_svn->{path}; my $pfx = defined($switch_path) ? $switch_path : $git_svn->path;
$pfx .= '/' if length($pfx); $pfx .= '/' if length($pfx);
while (<$ls>) { while (<$ls>) {
chomp; chomp;

View File

@ -262,7 +262,7 @@ sub get_commit_editor {
sub gs_do_update { sub gs_do_update {
my ($self, $rev_a, $rev_b, $gs, $editor) = @_; my ($self, $rev_a, $rev_b, $gs, $editor) = @_;
my $new = ($rev_a == $rev_b); my $new = ($rev_a == $rev_b);
my $path = $gs->{path}; my $path = $gs->path;
if ($new && -e $gs->{index}) { if ($new && -e $gs->{index}) {
unlink $gs->{index} or die unlink $gs->{index} or die
@ -298,7 +298,7 @@ sub gs_do_update {
# svn_ra_reparent didn't work before 1.4) # svn_ra_reparent didn't work before 1.4)
sub gs_do_switch { sub gs_do_switch {
my ($self, $rev_a, $rev_b, $gs, $url_b, $editor) = @_; my ($self, $rev_a, $rev_b, $gs, $url_b, $editor) = @_;
my $path = $gs->{path}; my $path = $gs->path;
my $pool = SVN::Pool->new; my $pool = SVN::Pool->new;
my $full_url = $self->url; my $full_url = $self->url;
@ -342,7 +342,7 @@ sub longest_common_path {
my $common_max = scalar @$gsv; my $common_max = scalar @$gsv;
foreach my $gs (@$gsv) { foreach my $gs (@$gsv) {
my @tmp = split m#/#, $gs->{path}; my @tmp = split m#/#, $gs->path;
my $p = ''; my $p = '';
foreach (@tmp) { foreach (@tmp) {
$p .= length($p) ? "/$_" : $_; $p .= length($p) ? "/$_" : $_;