[Bps-public-commit] r15008 - in Shipwright/branches/2.0: lib/Shipwright/Backend

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Aug 11 12:23:45 EDT 2008


Author: sunnavy
Date: Mon Aug 11 12:23:44 2008
New Revision: 15008

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

Log:
 r15557 at sunnavys-mb:  sunnavy | 2008-08-12 00:22:26 +0800
 import cmd of svk does not commit content changes if the file already exists in repo


Modified: Shipwright/branches/2.0/lib/Shipwright/Backend/SVK.pm
==============================================================================
--- Shipwright/branches/2.0/lib/Shipwright/Backend/SVK.pm	(original)
+++ Shipwright/branches/2.0/lib/Shipwright/Backend/SVK.pm	Mon Aug 11 12:23:44 2008
@@ -97,35 +97,40 @@
             ];
         }
         else {
-            if ( my $script_dir = $args{build_script} ) {
-                @cmd = [
-                    'svk',       'import',
-                    $script_dir, $self->repository . "/scripts/$args{name}/",
-                    '-m',        q{'} . $args{comment} . q{'},
-                ];
+            my ( $path, $source );
+            if ( $args{build_script} ) {
+                $path   = "/scripts/$args{name}";
+                $source = $args{build_script};
             }
             else {
-                if ( $self->has_branch_support ) {
-                    @cmd = [
-                        'svk',
-                        'import',
-                        $args{source},
-                        $self->repository . "/sources/$args{name}/$args{as}",
-                        '-m',
-                        q{'} . $args{comment} . q{'},
-                    ];
-                }
-                else {
-                    @cmd = [
-                        'svk',
-                        'import',
-                        $args{source},
-                        $self->repository . "/dists/$args{name}",
-                        '-m',
-                        q{'} . $args{comment} . q{'},
-                    ];
+                $path =
+                  $self->has_branch_support
+                  ? "/sources/$args{name}/$args{as}"
+                  : "/dists/$args{name}";
+                $source = $args{source};
+            }
 
-                }
+            if ( $self->info( path => $path ) ) {
+                my $tmp_dir = tempdir( CLEANUP => 1 );
+                @cmd = (
+                    [ 'rm',  '-rf', "$tmp_dir" ],
+                    [ 'svk', 'checkout', $self->repository . $path, $tmp_dir ],
+                    [ 'rm',  '-rf', "$tmp_dir" ],
+                    [ 'cp',  '-r',  $source,                   "$tmp_dir" ],
+                    [
+                        'svk',      'commit',
+                        '--import', $tmp_dir,
+                        '-m',       q{'} . $args{comment} . q{'}
+                    ],
+                    [ 'svk', 'checkout', '-d', $tmp_dir ],
+                );
+            }
+            else {
+                @cmd = [
+                    'svk',   'import',
+                    $source, $self->repository . $path,
+                    '-m',    q{'} . $args{comment} . q{'},
+                ];
             }
         }
     }



More information about the Bps-public-commit mailing list