[svk-commit] r2482 - in branches/2.0-releng: t/mirror

nobody at bestpractical.com nobody at bestpractical.com
Tue Jul 17 11:20:55 EDT 2007


Author: clkao
Date: Tue Jul 17 11:20:54 2007
New Revision: 2482

Modified:
   branches/2.0-releng/lib/SVK/Command/Mirror.pm
   branches/2.0-releng/t/mirror/relocate.t

Log:
merge from trunk:
 r2384 at trunk:  nothingmuch | 2007-04-12 12:40:59 +0100
 fix Can't call method "relocate" on an undefined value at SVK/Command/Mirror.pm line 116.


Modified: branches/2.0-releng/lib/SVK/Command/Mirror.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Command/Mirror.pm	(original)
+++ branches/2.0-releng/lib/SVK/Command/Mirror.pm	Tue Jul 17 11:20:54 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: branches/2.0-releng/t/mirror/relocate.t
==============================================================================
--- branches/2.0-releng/t/mirror/relocate.t	(original)
+++ branches/2.0-releng/t/mirror/relocate.t	Tue Jul 17 11:20:54 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