[svk-commit] r3102 - in branches/git-storage/lib/SVK: Depot

nobody at bestpractical.com nobody at bestpractical.com
Thu Oct 30 02:07:22 EDT 2008


Author: clkao
Date: Thu Oct 30 02:07:21 2008
New Revision: 3102

Added:
   branches/git-storage/lib/SVK/Depot/
   branches/git-storage/lib/SVK/Depot/Git.pm
Modified:
   branches/git-storage/lib/SVK/Command.pm
   branches/git-storage/lib/SVK/Depot.pm
   branches/git-storage/lib/SVK/XD.pm

Log:
SVK::Depot::git.

Modified: branches/git-storage/lib/SVK/Command.pm
==============================================================================
--- branches/git-storage/lib/SVK/Command.pm	(original)
+++ branches/git-storage/lib/SVK/Command.pm	Thu Oct 30 02:07:21 2008
@@ -597,7 +597,7 @@
             if ($repospath =~ m{\.git/?$}) {
                 require SVK::Path::Git;
                 my $p = SVK::Path::Git->real_new
-                    ({ depot => SVK::Depot->new({ repospath => $repospath, depotname => $depotname }),
+                    ({ depot => SVK::Depot::Git->new({ repospath => $repospath, depotname => $depotname }),
                        commit => 'HEAD',
                        path => $path,
                 } );

Modified: branches/git-storage/lib/SVK/Depot.pm
==============================================================================
--- branches/git-storage/lib/SVK/Depot.pm	(original)
+++ branches/git-storage/lib/SVK/Depot.pm	Thu Oct 30 02:07:21 2008
@@ -64,6 +64,28 @@
 
 =head1 DESCRIPTION
 
+=cut
+
+my %REPOS;
+my $REPOSPOOL = SVN::Pool->new;
+
+sub _open_repos {
+    my ($repospath) = @_;
+    $REPOS{$repospath} ||= SVN::Repos::open ($repospath, $REPOSPOOL);
+}
+
+sub new {
+    my $class = shift;
+    my $self = $class->SUPER::new(@_);
+    $self->setup;
+    return $self;
+}
+
+sub setup {
+    my $self = shift;
+    $self->repos(_open_repos($self->repospath)) unless $self->repos;
+}
+
 =over
 
 =item mirror

Added: branches/git-storage/lib/SVK/Depot/Git.pm
==============================================================================
--- (empty file)
+++ branches/git-storage/lib/SVK/Depot/Git.pm	Thu Oct 30 02:07:21 2008
@@ -0,0 +1,11 @@
+package SVK::Depot::Git;
+use strict;
+use SVK::Version;  our $VERSION = $SVK::VERSION;
+
+use base 'SVK::Depot';
+
+sub repos {
+    Carp::confess "should not access git depot repos";
+}
+
+1;

Modified: branches/git-storage/lib/SVK/XD.pm
==============================================================================
--- branches/git-storage/lib/SVK/XD.pm	(original)
+++ branches/git-storage/lib/SVK/XD.pm	Thu Oct 30 02:07:21 2008
@@ -426,12 +426,8 @@
 
 =cut
 
-my %REPOS;
-my $REPOSPOOL = SVN::Pool->new;
-
 sub _open_repos {
-    my ($repospath) = @_;
-    $REPOS{$repospath} ||= SVN::Repos::open ($repospath, $REPOSPOOL);
+    goto \&SVK::Depot::_open_repos;
 }
 
 =item find_repos
@@ -483,8 +479,7 @@
     }
 
     return SVK::Depot->new( { depotname => $depotname,
-                              repospath => $repospath,
-                              repos => _open_repos($repospath) } );
+                              repospath => $repospath } );
 }
 
 =item find_repos_from_co


More information about the svk-commit mailing list