[Bps-public-commit] r17026 - Shipwright/branches/1.10/lib/Shipwright/Backend

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Nov 26 14:32:08 EST 2008


Author: sunnavy
Date: Wed Nov 26 14:32:08 2008
New Revision: 17026

Modified:
   Shipwright/branches/1.10/lib/Shipwright/Backend/SVK.pm

Log:
merged 10724:10725 to 1.1

Modified: Shipwright/branches/1.10/lib/Shipwright/Backend/SVK.pm
==============================================================================
--- Shipwright/branches/1.10/lib/Shipwright/Backend/SVK.pm	(original)
+++ Shipwright/branches/1.10/lib/Shipwright/Backend/SVK.pm	Wed Nov 26 14:32:08 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;
@@ -69,10 +83,10 @@
     }
     elsif ( $type eq 'export' ) {
         $cmd =
-          [ 'svk', 'checkout', $self->repository . $args{path}, $args{target} ];
+          [ 'svn', 'export', $self->_svnroot . $args{path}, $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} ) {
@@ -131,7 +145,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