[svk-commit] r2217 - in branches/2.0-releng: lib/SVK/Mirror/Backend

nobody at bestpractical.com nobody at bestpractical.com
Tue Dec 5 13:35:19 EST 2006


Author: clkao
Date: Tue Dec  5 13:35:18 2006
New Revision: 2217

Modified:
   branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRa.pm
   branches/2.0-releng/utils/verify-mirror

Log:
Fix the ra session cache and reparent logic.  Do necessary reparent
when reusing sessions, rather than when caching them.


Modified: branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRa.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRa.pm	(original)
+++ branches/2.0-releng/lib/SVK/Mirror/Backend/SVNRa.pm	Tue Dec  5 13:35:18 2006
@@ -301,25 +301,31 @@
 }
 
 sub _new_ra {
-    my ($self, %args) = @_;
-
-    return delete $self->{_cached_ra} if $self->_cached_ra;
+    my ( $self, %args ) = @_;
 
+    if ( $self->_cached_ra ) {
+        my $ra = delete $self->{_cached_ra};
+        my $url = $args{url} || $self->mirror->url;
+        return $ra if $ra->{url} eq $url;
+        if ( _p_svn_ra_session_t->can('reparent') ) {
+            $ra->reparent($url);
+            $ra->{url} = $url;
+            return $ra;
+        }
+    }
     $self->_initialize_svn;
-    return SVN::Ra->new( url => $self->mirror->url,
-                         auth => $self->_auth_baton,
-                         config => $self->_config, %args );
+    return SVN::Ra->new(
+        url    => $self->mirror->url,
+        auth   => $self->_auth_baton,
+        config => $self->_config,
+        %args
+    );
 }
 
 sub _ra_finished {
     my ($self, $ra) = @_;
     return if $self->_cached_ra;
     return if ref($ra) eq 'SVK::Mirror::Backend::SVNRaPipe';
-    if ($ra->{url} ne $self->mirror->url) {
-	return unless _p_svn_ra_session_t->can('reparent');
-	$ra->reparent($self->mirror->url);
-    }
-
     $self->_cached_ra( $ra );
 }
 

Modified: branches/2.0-releng/utils/verify-mirror
==============================================================================
--- branches/2.0-releng/utils/verify-mirror	(original)
+++ branches/2.0-releng/utils/verify-mirror	Tue Dec  5 13:35:18 2006
@@ -31,7 +31,7 @@
     sub {
         my ( $paths, $r, $author, $date, $log, $ppool ) = @_;
         my $pool = SVN::Pool->new($ppool);
-        for my $remotepath ( keys %$paths ) {
+        for my $remotepath ( sort keys %$paths ) {
             $pool->clear;
             my $localpath = Path::Class::Dir->new_foreign('Unix', $path)->subdir( $remotepath );
             my $local     = delete $changed->{$localpath}
@@ -61,7 +61,6 @@
                 my ( $parent, $target ) = ( $p->parent, $p->basename );
 
                 # do md5 comparison
-
                 my $fra = $rabackend->_new_ra(
                     url => $m->url . ( $parent eq '/' ? '' : $parent ) );
 
@@ -84,6 +83,8 @@
                 # $reporter->set_path( $target, $rev-1, 1, '' );
                 $reporter->finish_report;
 
+                $rabackend->_ra_finished($fra);
+
                 die "no md5 found from server for $remotepath ($target)"
                     unless $md5->{$target};
 


More information about the svk-commit mailing list