1847
$gs->ra->gs_do_switch($r0, $rev, $gs,
1848
$self->full_url, $ed)
1849
or die "SVN connection failed somewhere...\n";
1850
+ } elsif ($self->ra->trees_match($new_url, $r0,
1851
+ $self->full_url, $rev)) {
1852
+ print STDERR "Trees match:\n",
1853
+ " $new_url\@$r0\n",
1854
+ " ${\$self->full_url}\@$rev\n",
1855
+ "Following parent with no changes\n";
1856
+ $self->tmp_index_do(sub {
1857
+ command_noisy('read-tree', $parent);
1858
+ });
1859
+ $self->{last_commit} = $parent;
1860
} else {
1861
print STDERR "Following parent with do_update\n";
1862
$ed = SVN::Git::Fetcher->new($self);
3037
}
3038
}
3039
3040
+sub _auth_providers () {
3041
+ [
3042
+ SVN::Client::get_simple_provider(),
3043
+ SVN::Client::get_ssl_server_trust_file_provider(),
3044
+ SVN::Client::get_simple_prompt_provider(
3045
+ \&Git::SVN::Prompt::simple, 2),
3046
+ SVN::Client::get_ssl_client_cert_file_provider(),
3047
+ SVN::Client::get_ssl_client_cert_prompt_provider(
3048
+ \&Git::SVN::Prompt::ssl_client_cert, 2),
3049
+ SVN::Client::get_ssl_client_cert_pw_prompt_provider(
3050
+ \&Git::SVN::Prompt::ssl_client_cert_pw, 2),
3051
+ SVN::Client::get_username_provider(),
3052
+ SVN::Client::get_ssl_server_trust_prompt_provider(
3053
+ \&Git::SVN::Prompt::ssl_server_trust),
3054
+ SVN::Client::get_username_prompt_provider(
3055
+ \&Git::SVN::Prompt::username, 2)
3056
+ ]
3057
+}
3058
+
3059
sub new {
3060
my ($class, $url) = @_;
3061
$url =~ s!/+$!!;
3062
return $RA if ($RA && $RA->{url} eq $url);
3063
3064
SVN::_Core::svn_config_ensure($config_dir, undef);
3036
- my ($baton, $callbacks) = SVN::Core::auth_open_helper([
3037
- SVN::Client::get_simple_provider(),
3038
- SVN::Client::get_ssl_server_trust_file_provider(),
3039
- SVN::Client::get_simple_prompt_provider(
3040
- \&Git::SVN::Prompt::simple, 2),
3041
- SVN::Client::get_ssl_client_cert_file_provider(),
3042
- SVN::Client::get_ssl_client_cert_prompt_provider(
3043
- \&Git::SVN::Prompt::ssl_client_cert, 2),
3044
- SVN::Client::get_ssl_client_cert_pw_prompt_provider(
3045
- \&Git::SVN::Prompt::ssl_client_cert_pw, 2),
3046
- SVN::Client::get_username_provider(),
3047
- SVN::Client::get_ssl_server_trust_prompt_provider(
3048
- \&Git::SVN::Prompt::ssl_server_trust),
3049
- SVN::Client::get_username_prompt_provider(
3050
- \&Git::SVN::Prompt::username, 2),
3051
- ]);
3065
+ my ($baton, $callbacks) = SVN::Core::auth_open_helper(_auth_providers);
3066
my $config = SVN::Core::config_get_config($config_dir);
3067
$RA = undef;
3068
my $self = SVN::Ra->new(url => $url, auth => $baton,
3126
$ret;
3127
}
3128
3129
+sub trees_match {
3130
+ my ($self, $url1, $rev1, $url2, $rev2) = @_;
3131
+ my $ctx = SVN::Client->new(auth => _auth_providers);
3132
+ my $out = IO::File->new_tmpfile;
3133
+
3134
+ # older SVN (1.1.x) doesn't take $pool as the last parameter for
3135
+ # $ctx->diff(), so we'll create a default one
3136
+ my $pool = SVN::Pool->new_default_sub;
3137
+
3138
+ $ra_invalid = 1; # this will open a new SVN::Ra connection to $url1
3139
+ $ctx->diff([], $url1, $rev1, $url2, $rev2, 1, 1, 0, $out, $out);
3140
+ $out->flush;
3141
+ my $ret = (($out->stat)[7] == 0);
3142
+ close $out or croak $!;
3143
+
3144
+ $ret;
3145
+}
3146
+
3147
sub get_commit_editor {
3148
my ($self, $log, $cb, $pool) = @_;
3149
my @lock = $SVN::Core::VERSION ge '1.2.0' ? (undef, 0) : ();