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

nobody at bestpractical.com nobody at bestpractical.com
Thu Oct 30 02:48:32 EDT 2008


Author: clsung
Date: Thu Oct 30 02:48:32 2008
New Revision: 3108

Modified:
   branches/git-storage/lib/SVK/Depot/Git.pm
   branches/git-storage/lib/SVK/Path/Git.pm
   branches/git-storage/lib/SVK/Test.pm
   branches/git-storage/lib/SVK/XD.pm

Log:
- some fix and enhance

Modified: branches/git-storage/lib/SVK/Depot/Git.pm
==============================================================================
--- branches/git-storage/lib/SVK/Depot/Git.pm	(original)
+++ branches/git-storage/lib/SVK/Depot/Git.pm	Thu Oct 30 02:48:32 2008
@@ -8,6 +8,9 @@
     Carp::confess "should not access git depot repos";
 }
 
+sub setup {
+}
+
 sub run_cmd {
     my $self = shift;
     return `git --git-dir @{[ $self->repospath ]} @_`;

Modified: branches/git-storage/lib/SVK/Path/Git.pm
==============================================================================
--- branches/git-storage/lib/SVK/Path/Git.pm	(original)
+++ branches/git-storage/lib/SVK/Path/Git.pm	Thu Oct 30 02:48:32 2008
@@ -13,6 +13,11 @@
 __PACKAGE__->mk_clonable_accessors();
 push @{__PACKAGE__->_clonable_accessors}, 'path_anchor';
 
+for my $proxy (qw/depotname repospath/) {
+    no strict 'refs';
+    *{$proxy} = sub { my $self = shift; $self->depot; $self->depot->$proxy(@_) }
+}
+
 *path = *path_anchor;
 
 #__PACKAGE__->mk_accessors(qw(path));
@@ -60,10 +65,6 @@
     return 1;
 }
 
-sub depotname {
-    return $_[0]->depot->depotname;
-}
-
 sub depotpath {
     my $self = shift;
 

Modified: branches/git-storage/lib/SVK/Test.pm
==============================================================================
--- branches/git-storage/lib/SVK/Test.pm	(original)
+++ branches/git-storage/lib/SVK/Test.pm	Thu Oct 30 02:48:32 2008
@@ -60,13 +60,13 @@
 
 use SVK::Logger;
 
-our @EXPORT = qw(plan_svm new_repos build_test build_git_test build_floating_test
+our @EXPORT = qw(plan_svm new_repos build_test build_floating_test
 		 get_copath append_file overwrite_file
 		 overwrite_file_raw is_file_content
 		 is_file_content_raw _do_run is_output
 		 is_sorted_output is_deeply_like is_output_like
 		 is_output_unlike is_ancestor status_native status
-		 get_editor create_basic_tree create_basic_git_tree waste_rev
+		 get_editor create_basic_tree waste_rev
 		 tree_from_fsroot tree_from_xdroot __ _x not_x _l
 		 not_l uri set_editor replace_file glob_mime_samples
 		 create_mime_samples chmod_probably_useless
@@ -217,19 +217,7 @@
 sub build_test {
     my (@depot) = @_;
 
-    my $depotmap = {map {$_ => (new_repos())[0]} '', at depot};
-    my $xd = SVK::XD->new (depotmap => $depotmap,
-			   svkpath => $depotmap->{''});
-    my $svk = SVK->new (xd => $xd, $ENV{DEBUG_INTERACTIVE} ? () : (output => \$output));
-    push @TOCLEAN, [$xd, $svk];
-    return ($xd, $svk);
-}
-
-# XXX: redundant code of build_test, should have a better way
-sub build_git_test {
-    my (@depot) = @_;
-
-    my $depotmap = {map {$_ => (new_repos_git())[0]} '', at depot};
+    my $depotmap = {map {$_ => ($ENV{SVKTESTGIT} ? new_repos_git() : new_repos())[0]} '', at depot};
     my $xd = SVK::XD->new (depotmap => $depotmap,
 			   svkpath => $depotmap->{''});
     my $svk = SVK->new (xd => $xd, $ENV{DEBUG_INTERACTIVE} ? () : (output => \$output));
@@ -485,6 +473,7 @@
 
 sub create_basic_tree {
     my ($xd, $depotpath) = @_;
+    goto &create_basic_git_tree if ($ENV{SVKTESTGIT});
     my $pool = SVN::Pool->new_default;
     my ($depot, $path) = $xd->find_depotpath($depotpath);
 

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:48:32 2008
@@ -71,6 +71,7 @@
 use Class::Autouse qw( Path::Class SVK::Editor::Delay );
 use Fcntl qw(:flock);
 use SVK::Depot;
+use SVK::Depot::Git;
 use SVK::Config;
 
 use SVK::Logger;
@@ -475,7 +476,7 @@
     my ($self, $depotname) = @_;
     my $repospath = $self->{depotmap}{$depotname} or die loc("No such depot: %1.\n", $depotname);
     if ($repospath =~ m{\.git/?$}) {
-        return SVK::Depot->new({ repospath => $repospath, depotname => $depotname });
+        return SVK::Depot::Git->new({ repospath => $repospath, depotname => $depotname });
     }
 
     return SVK::Depot->new( { depotname => $depotname,


More information about the svk-commit mailing list