[svk-commit] r2340 - in branches/2.0-releng/lib/SVK: .

nobody at bestpractical.com nobody at bestpractical.com
Wed Mar 14 20:43:01 EDT 2007


Author: clkao
Date: Wed Mar 14 20:43:00 2007
New Revision: 2340

Modified:
   branches/2.0-releng/lib/SVK/Command/Log.pm
   branches/2.0-releng/lib/SVK/MirrorCatalog.pm

Log:
Merge from trunk:
 r2306 at trunk:  clkao | 2007-03-04 20:27:29 +0000
 Make mirror catalog cache the SVK::Mirror instances as well.


Modified: branches/2.0-releng/lib/SVK/Command/Log.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Command/Log.pm	(original)
+++ branches/2.0-releng/lib/SVK/Command/Log.pm	Wed Mar 14 20:43:00 2007
@@ -77,7 +77,7 @@
     my ( $target, $remoteonly ) = @_;
 
     # don't bother if this repository has no mirror
-    return if !$target->mirror->_entries;
+    return unless $target->mirror->entries;
 
     # we might be running log on a path containing mirrors.
     # FIXME: resolve when log outside mirror anchor

Modified: branches/2.0-releng/lib/SVK/MirrorCatalog.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/MirrorCatalog.pm	(original)
+++ branches/2.0-releng/lib/SVK/MirrorCatalog.pm	Wed Mar 14 20:43:00 2007
@@ -56,7 +56,7 @@
 use SVK::Mirror;
 use SVK::Config;
 
-__PACKAGE__->mk_accessors(qw(depot repos cb_lock revprop));
+__PACKAGE__->mk_accessors(qw(depot repos cb_lock revprop _cached_mirror));
 
 =head1 NAME
 
@@ -75,8 +75,8 @@
 
 sub entries {
     my $self = shift;
-    my %mirrors = $self->_entries;
-    return sort keys %mirrors;
+    return sort keys %{$self->_entries} if wantarray;
+    return scalar keys %{$self->_entries};
 }
 
 sub _entries {
@@ -85,12 +85,12 @@
     my $rev = $repos->fs->youngest_rev;
     delete $mirror_cached{$repos}
 	unless ($mirror_cached{$repos}{rev} || -1) == $rev;
-    return %{$mirror_cached{$repos}{hash}}
+    return $mirror_cached{$repos}{hash}
 	if exists $mirror_cached{$repos};
 
     if ($repos->fs->revision_prop(0, 'svn:svnsync:from-url')) {
-	$mirror_cached{$repos} = { rev => $rev, hash => { '/' => 1 } };
-	return ( '/' => 1 );
+	$mirror_cached{$repos} = { rev => $rev, hash => { '/' => undef } };
+	return { '/' => undef };
     }
 
     my @mirrors = grep length,
@@ -99,22 +99,20 @@
 
     my %mirrored = map {
 	local $@;
-	eval {
+	my $m = eval {
             SVK::Mirror->load( { path => $_, depot => $self->depot, pool => SVN::Pool->new });
-	    1;
 	};
-        $@ ? () : ($_ => 1)
+        $@ ? () : ($_ => $m)
 
     } @mirrors;
 
     $mirror_cached{$repos} = { rev => $rev, hash => \%mirrored};
-    return %mirrored;
+    return \%mirrored;
 }
 
 sub get {
     my ($self, $path) = @_;
-    Carp::cluck if ref($path);
-    return SVK::Mirror->load( { path => $path, depot => $self->depot, pool => SVN::Pool->new });
+    return $self->_entries->{$path} || SVK::Mirror->load( { path => $path, depot => $self->depot, pool => SVN::Pool->new });;
 }
 
 sub unlock {


More information about the svk-commit mailing list