[svk-commit] r2220 - in trunk: lib/SVK/Mirror/Backend utils

nobody at bestpractical.com nobody at bestpractical.com
Tue Dec 5 13:41:42 EST 2006


Author: clkao
Date: Tue Dec  5 13:41:42 2006
New Revision: 2220

Modified:
   trunk/   (props changed)
   trunk/lib/SVK/Mirror/Backend/SVNRa.pm
   trunk/utils/verify-mirror

Log:
 r7381 at ubuntu (orig r2217):  clkao | 2006-12-06 02:35:18 +0800
 Fix the ra session cache and reparent logic.  Do necessary reparent
 when reusing sessions, rather than when caching them.
 


Modified: trunk/lib/SVK/Mirror/Backend/SVNRa.pm
==============================================================================
--- trunk/lib/SVK/Mirror/Backend/SVNRa.pm	(original)
+++ trunk/lib/SVK/Mirror/Backend/SVNRa.pm	Tue Dec  5 13:41:42 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: trunk/utils/verify-mirror
==============================================================================
--- trunk/utils/verify-mirror	(original)
+++ trunk/utils/verify-mirror	Tue Dec  5 13:41:42 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