+sub set_svm_vars {
+ my ($self, $ra) = @_;
+ my $section = "svn-remote.$self->{repo_id}";
+
+ # see if we have it in our config, first:
+ eval {
+ $self->{svm} = {
+ source => $self->tmp_config('--get', "$section.svm-source"),
+ uuid => $self->tmp_config('--get', "$section.svm-uuid"),
+ }
+ };
+ return $ra if ($self->{svm}->{source} && $self->{svm}->{uuid});
+
+ # nope, make sure we're connected to the repository root:
+ if ($ra->{repos_root} ne $self->{url}) {
+ $ra = Git::SVN::Ra->new($ra->{repos_root});
+ }
+ my $r = $ra->get_latest_revnum;
+ my ($props) = ($ra->get_dir('', $r))[2];
+ if (my $src = $props->{'svm:source'}) {
+ # don't know what a '!' is there for, also the
+ # username is of no interest
+ $src =~ s{!$}{};
+ $src =~ s{(^[a-z\+]*://)[^/@]*@}{$1};
+ $self->tmp_config('--add', "$section.svm-source", $src);
+
+ my $uuid = $props->{'svm:uuid'};
+ $uuid =~ m{^[0-9a-f\-]{30,}$}
+ or die "doesn't look right - svm:uuid is '$uuid'\n";
+ $self->tmp_config('--add', "$section.svm-uuid", $uuid);
+
+ $self->{svm} = { source => $src , uuid => $uuid };
+ }
+ if ($ra->{repos_root} ne $self->{url}) {
+ $ra = Git::SVN::Ra->new($self->{url});
+ }
+ $ra;
+}
+