summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f7c3fc4)
raw | patch | inline | side by side (parent: f7c3fc4)
author | Eric Wong <normalperson@yhbt.net> | |
Tue, 30 Jan 2007 03:16:01 +0000 (19:16 -0800) | ||
committer | Eric Wong <normalperson@yhbt.net> | |
Fri, 23 Feb 2007 08:57:10 +0000 (00:57 -0800) |
I can't seem to figure out what I or the SVN libraries are doing
wrong, but it appears to be related to reparent and probably
some global structure that gets reset if multiple SVN
connections are being used.
So now, in order to use do_switch; we'll open a new connection
to the repository with the complete URL; but we can't seem to
ever use an existing Ra object after another one has been
created...
Signed-off-by: Eric Wong <normalperson@yhbt.net>
wrong, but it appears to be related to reparent and probably
some global structure that gets reset if multiple SVN
connections are being used.
So now, in order to use do_switch; we'll open a new connection
to the repository with the complete URL; but we can't seem to
ever use an existing Ra object after another one has been
created...
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn.perl | patch | blob | history |
diff --git a/git-svn.perl b/git-svn.perl
index bbdaeea98a11dea4e3bbf717be665ea75e99ae81..4e357dfcef8bdec39932d565d77e271bbb97b979 100755 (executable)
--- a/git-svn.perl
+++ b/git-svn.perl
sub ra {
my ($self) = shift;
- $self->{ra} ||= Git::SVN::Ra->new($self->{url});
+ Git::SVN::Ra->new($self->{url});
}
sub rel_path {
sub traverse_ignore {
my ($self, $fh, $path, $r) = @_;
$path =~ s#^/+##g;
- my ($dirent, undef, $props) = $self->ra->get_dir($path, $r);
+ my $ra = $self->ra;
+ my ($dirent, undef, $props) = $ra->get_dir($path, $r);
my $p = $path;
- $p =~ s#^\Q$self->{ra}->{svn_path}\E/##;
+ $p =~ s#^\Q$ra->{svn_path}\E/##;
print $fh length $p ? "\n# $p\n" : "\n# /\n";
if (my $s = $props->{'svn:ignore'}) {
$s =~ s/[\r\n]+/\n/g;
sub full_url {
my ($self) = @_;
- $self->ra->{url} . (length $self->{path} ? '/' . $self->{path} : '');
+ $self->{url} . (length $self->{path} ? '/' . $self->{path} : '');
}
sub do_git_commit {
use strict;
use warnings;
my ($can_do_switch);
-my %RA;
+my $RA;
BEGIN {
# enforce temporary pool usage for some simple functions
sub new {
my ($class, $url) = @_;
$url =~ s!/+$!!;
- return $RA{$url} if $RA{$url};
+ return $RA if ($RA && $RA->{url} eq $url);
SVN::_Core::svn_config_ensure($config_dir, undef);
my ($baton, $callbacks) = SVN::Core::auth_open_helper([
$self->{svn_path} = $url;
$self->{repos_root} = $self->get_repos_root;
$self->{svn_path} =~ s#^\Q$self->{repos_root}\E/*##;
- $RA{$url} = bless $self, $class;
+ $RA = bless $self, $class;
}
sub DESTROY {
- # do not call the real DESTROY since we store ourselves in %RA
+ # do not call the real DESTROY since we store ourselves in $RA
}
sub get_log {
my $full_url = $self->{url};
my $old_url = $full_url;
$full_url .= "/$path" if length $path;
- SVN::_Ra::svn_ra_reparent($self->{session}, $full_url, $pool);
- $self->{url} = $full_url;
-
- my $reporter = $self->do_switch($rev_b, '',
- $recurse, $url_b, $editor, $pool);
+ my ($ra, $reparented);
+ if ($old_url ne $full_url) {
+ if ($old_url !~ m#^svn(\+ssh)?://#) {
+ SVN::_Ra::svn_ra_reparent($self->{session}, $full_url,
+ $pool);
+ $self->{url} = $full_url;
+ $reparented = 1;
+ } else {
+ $ra = Git::SVN::Ra->new($full_url);
+ }
+ }
+ $ra ||= $self;
+ my $reporter = $ra->do_switch($rev_b, '',
+ $recurse, $url_b, $editor, $pool);
my @lock = $SVN::Core::VERSION ge '1.2.0' ? (undef) : ();
$reporter->set_path('', $rev_a, 0, @lock, $pool);
$reporter->finish_report($pool);
- SVN::_Ra::svn_ra_reparent($self->{session}, $old_url, $pool);
- $self->{url} = $old_url;
+ if ($reparented) {
+ SVN::_Ra::svn_ra_reparent($self->{session}, $old_url, $pool);
+ $self->{url} = $old_url;
+ }
$pool->clear;
$editor->{git_commit_ok};