[Bps-public-commit] r17024 - in Shipwright/trunk: lib/Shipwright/Backend

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Nov 26 14:30:18 EST 2008


Author: sunnavy
Date: Wed Nov 26 14:30:17 2008
New Revision: 17024

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright/Backend/SVK.pm

Log:
 r17933 at sunnavys-mb:  sunnavy | 2008-11-27 03:30:01 +0800
 hack svk backend to use svn sometimes to make shipwright faster


Modified: Shipwright/trunk/lib/Shipwright/Backend/SVK.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	Wed Nov 26 14:30:17 2008
@@ -42,6 +42,20 @@
     );
 }
 
+sub _svnroot {
+    my $self = shift;
+    return $self->{svnroot} if $self->{svnroot};
+    my $depotmap = Shipwright::Util->run( [ svk => depotmap => '--list' ] );
+    $depotmap =~ s{\A.*^(?=/)}{}sm;
+    while ($depotmap =~ /^(\S*)\s+(.*?)$/gm) {
+        my ($depot, $svnroot) = ($1, $2);
+        if ($self->repository =~ /^$depot(.*)/) {
+            return $self->{svnroot} = "file://$svnroot/$1";
+        }
+    }
+    croak "Can't find determine underlying SVN repository for ". $self->repository;
+}
+
 # a cmd generating factory
 sub _cmd {
     my $self = shift;
@@ -70,14 +84,13 @@
     elsif ( $type eq 'export' ) {
         @cmd = (
             [
-                'svk',                           'checkout',
-                $self->repository . $args{path}, $args{target}
+                'svn',                           'export',
+                $self->_svnroot . $args{path}, $args{target}
             ],
-            [ 'svk', 'checkout', '-d', $args{target} ]
         );
     }
     elsif ( $type eq 'list' ) {
-        @cmd = [ 'svk', 'list', $self->repository . $args{path} ];
+        @cmd = [ 'svn', 'list', $self->_svnroot . $args{path} ];
     }
     elsif ( $type eq 'import' ) {
         if ( $args{_initialize} ) {
@@ -158,7 +171,7 @@
         @cmd = [ 'svk', 'info', $self->repository . $args{path} ];
     }
     elsif ( $type eq 'cat' ) {
-        @cmd = [ 'svk', 'cat', $self->repository . $args{path} ];
+        @cmd = [ 'svn', 'cat', $self->_svnroot . $args{path} ];
     }
     else {
         croak "invalid command: $type";



More information about the Bps-public-commit mailing list