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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Jun 6 05:16:13 EDT 2008


Author: sunnavy
Date: Fri Jun  6 05:15:49 2008
New Revision: 12953

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

Log:
 r13043 at sunnavys-mb:  sunnavy | 2008-06-06 17:04:59 +0800
 added move methods for backends


Modified: Shipwright/trunk/lib/Shipwright/Backend/SVK.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	Fri Jun  6 05:15:49 2008
@@ -6,7 +6,7 @@
 use File::Spec;
 use Shipwright::Util;
 use File::Temp qw/tempdir/;
-use File::Copy;
+use File::Copy qw/copy/;
 use File::Copy::Recursive qw/dircopy/;
 
 our %REQUIRE_OPTIONS = ( import => [qw/source/] );
@@ -243,6 +243,16 @@
             join '/', $self->repository, $args{path},
         ];
     }
+    elsif ( $type eq 'move' ) {
+        $cmd = [
+            'svk',
+            'move',
+            '-m',
+            q{'} . "move $args{path} to $args{new_path}" . q{'},
+            join( '/', $self->repository, $args{path} ),
+            join( '/', $self->repository, $args{new_path} )
+        ];
+    }
     elsif ( $type eq 'info' ) {
         $cmd = [ 'svk', 'info', join '/', $self->repository, $args{path} ];
     }
@@ -448,6 +458,29 @@
     }
 }
 
+=item move
+
+A wrapper around svk's move command.
+
+=cut
+
+sub move {
+    my $self     = shift;
+    my %args     = @_;
+    my $path     = $args{path} || '';
+    my $new_path = $args{new_path} || '';
+    if ( $self->info( path => $path ) ) {
+        $self->log->info(
+            "move " . $self->repository . "/$path to /$new_path" );
+        Shipwright::Util->run(
+            $self->_cmd(
+                move     => path => $path,
+                new_path => $new_path,
+            ),
+        );
+    }
+}
+
 =item info
 
 A wrapper around svk's info command.
@@ -643,7 +676,7 @@
 
     croak "$args{path} seems not shipwright's own file"
       unless -e File::Spec->catfile( Shipwright::Util->share_root,
-              $args{path} );
+        $args{path} );
 
     $args{path} = '/' . $args{path} unless $args{path} =~ m{^/};
 

Modified: Shipwright/trunk/lib/Shipwright/Backend/SVN.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/SVN.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/SVN.pm	Fri Jun  6 05:15:49 2008
@@ -6,7 +6,7 @@
 use File::Spec;
 use Shipwright::Util;
 use File::Temp qw/tempdir/;
-use File::Copy;
+use File::Copy qw/copy/;
 use File::Copy::Recursive qw/dircopy/;
 
 our %REQUIRE_OPTIONS = ( import => [qw/source/], );
@@ -240,6 +240,16 @@
             join '/', $self->repository, $args{path}
         ];
     }
+    elsif ( $type eq 'move' ) {
+        $cmd = [
+            'svn',
+            'move',
+            '-m',
+            q{'} . "move $args{path} to $args{new_path}" . q{'},
+            join( '/', $self->repository, $args{path} ),
+            join( '/', $self->repository, $args{new_path} )
+        ];
+    }
     elsif ( $type eq 'info' ) {
         $cmd = [ 'svn', 'info', join '/', $self->repository, $args{path} ];
     }
@@ -443,6 +453,29 @@
     }
 }
 
+=item move
+
+A wrapper around svn's move command.
+
+=cut
+
+sub move {
+    my $self     = shift;
+    my %args     = @_;
+    my $path     = $args{path} || '';
+    my $new_path = $args{new_path} || '';
+    if ( $self->info( path => $path ) ) {
+        $self->log->info(
+            "move " . $self->repository . "/$path to /$new_path" );
+        Shipwright::Util->run(
+            $self->_cmd(
+                move     => path => $path,
+                new_path => $new_path,
+            ),
+        );
+    }
+}
+
 =item info
 
 A wrapper around svn's info command.



More information about the Bps-public-commit mailing list