[svk-commit] r2384 - in trunk: t/mirror

nobody at bestpractical.com nobody at bestpractical.com
Thu Apr 12 07:41:01 EDT 2007


Author: nothingmuch
Date: Thu Apr 12 07:40:59 2007
New Revision: 2384

Modified:
   trunk/lib/SVK/Command/Mirror.pm
   trunk/t/mirror/relocate.t

Log:
fix Can't call method "relocate" on an undefined value at SVK/Command/Mirror.pm line 116.

Modified: trunk/lib/SVK/Command/Mirror.pm
==============================================================================
--- trunk/lib/SVK/Command/Mirror.pm	(original)
+++ trunk/lib/SVK/Command/Mirror.pm	Thu Apr 12 07:40:59 2007
@@ -113,7 +113,14 @@
 
 sub run {
     my ($self, $target, $source, @options) = @_;
-    $target->is_mirrored->relocate($source, @options);
+
+    my ($m, $mpath) = $target->is_mirrored;
+
+    die loc("%1 is not a mirrored path.\n", $target->depotpath) if !$m;
+    die loc("%1 is inside a mirrored path.\n", $target->depotpath) if $mpath;
+
+    $m->relocate($source, @options);
+
     print loc("Mirror relocated.\n");
     return;
 }

Modified: trunk/t/mirror/relocate.t
==============================================================================
--- trunk/t/mirror/relocate.t	(original)
+++ trunk/t/mirror/relocate.t	Thu Apr 12 07:40:59 2007
@@ -5,7 +5,7 @@
 use SVK::Util qw(HAS_SYMLINK);
 
 plan(skip_all => 'symlink not supported') if !HAS_SYMLINK;
-plan tests => 3;
+plan tests => 5;
 
 my ($xd, $svk) = build_test('test', 'test2');
 my ($copath, $corpath) = get_copath ('sync-replicate');
@@ -30,3 +30,9 @@
 
 is_output($svk, 'mirror', ['--relocate', '//m', "$uri2/A"],
 	  ['Mirror relocated.']);
+
+is_output($svk, 'mirror', ['--relocate','//bogus_mirror', "$uri2/B"],
+      ['//bogus_mirror is not a mirrored path.']);
+
+is_output($svk, 'mirror', ['--relocate','//m/bogus_mirror', "$uri2/B"],
+      ['//m/bogus_mirror is inside a mirrored path.']);


More information about the svk-commit mailing list