[svk-commit] r2164 - in trunk: t

clkao at bestpractical.com clkao at bestpractical.com
Sat Nov 18 00:18:10 EST 2006


Author: clkao
Date: Sat Nov 18 00:18:07 2006
New Revision: 2164

Modified:
   trunk/lib/SVK/Command/Checkout.pm
   trunk/t/11checkout.t

Log:
Make co --relocate do the right thing with sticky entries.

Modified: trunk/lib/SVK/Command/Checkout.pm
==============================================================================
--- trunk/lib/SVK/Command/Checkout.pm	(original)
+++ trunk/lib/SVK/Command/Checkout.pm	Sat Nov 18 00:18:07 2006
@@ -205,19 +205,25 @@
     }
 
     # Manually relocate all paths
-    my $map = $self->{xd}{checkout}{hash};
+    my $hmap = $self->{xd}{checkout}{hash};
 
     my $abs_path = abs_path($path);
-    if ($map->{$abs_path} and -d $abs_path) {
+    if ($hmap->{$abs_path} and -d $abs_path) {
         move_path($path => $report);
         $target = abs_path ($report);
     }
 
     my $prefix = $copath[0].$SEP;
     my $length = length($copath[0]);
-    foreach my $key (sort grep { index("$_$SEP", $prefix) == 0 } keys %$map) {
-        $map->{$target . substr($key, $length)} = delete $map->{$key};
-    }
+    my $relocate = sub {
+        my $map = shift;
+        for my $key ( sort grep { index( "$_$SEP", $prefix ) == 0 }
+            keys %$map ) {
+            $map->{ $target . substr( $key, $length ) } = delete $map->{$key};
+        }
+    };
+    $relocate->($hmap);
+    $relocate->($self->{xd}{checkout}{sticky});
 
     print loc("Checkout '%1' relocated to '%2'.\n", $path, $target);
 

Modified: trunk/t/11checkout.t
==============================================================================
--- trunk/t/11checkout.t	(original)
+++ trunk/t/11checkout.t	Sat Nov 18 00:18:07 2006
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-use Test::More tests => 68;
+use Test::More tests => 69;
 use strict;
 use SVK::Test;
 our($output, $answer);
@@ -335,7 +335,11 @@
             __("Checkout path '$corpath/3.1' detached."),
             ]);
 
+chdir("$corpath/co-root-deep/there");
+$svk->mkdir("newdir");
+is_output($svk, 'st', [], ['A   newdir']);
 
+chdir($corpath);
 rename("$corpath/co-root-deep/there", "$corpath/tmp");
 unlink("$corpath/co-root-deep");
 rename("$corpath/tmp", "$corpath/co-root-deep");
@@ -343,4 +347,8 @@
 is_output ($svk, 'checkout', ['--relocate', __("$corpath/co-root-deep/there"), __("$corpath/co-root-deep")], [
             __("Checkout '$corpath/co-root-deep/there' relocated to '$corpath/co-root-deep'."),
             ]);
-is_output($svk, 'st', ["$corpath/co-root-deep"], []);
+
+chdir("$corpath/co-root-deep");
+is_output($svk, 'st', [], ['A   newdir']);
+
+


More information about the svk-commit mailing list