[svk-commit] r2286 - in trunk: lib/SVK

nobody at bestpractical.com nobody at bestpractical.com
Sat Jan 6 07:46:42 EST 2007


Author: clkao
Date: Sat Jan  6 07:46:36 2007
New Revision: 2286

Modified:
   trunk/lib/SVK/MirrorCatalog.pm
   trunk/t/mirror/sync-replicate.t

Log:
Make sure is_mirrored returns additional paths that are concatable
to mirror url.  This fixes the bug committing to subdirs of mirrors
that are on /.


Modified: trunk/lib/SVK/MirrorCatalog.pm
==============================================================================
--- trunk/lib/SVK/MirrorCatalog.pm	(original)
+++ trunk/lib/SVK/MirrorCatalog.pm	Sat Jan  6 07:46:36 2007
@@ -122,6 +122,8 @@
     $self->get($path)->unlock('force');
 }
 
+
+# note that the additional path returned is to be concat to mirror url
 sub is_mirrored {
     my ($self, $path) = @_;
     # XXX: check there's only one
@@ -129,8 +131,12 @@
     return unless $mpath;
 
     my $m = $self->get($mpath);
-    $path =~ s/^\Q$mpath\E//;
-    return wantarray ? ($m, $path) : $m;
+    if ( $mpath eq '/' ) {
+	$path = '' if $path eq '/';
+    } else {
+        $path =~ s/^\Q$mpath\E//;
+    }
+    return wantarray ? ( $m, $path ) : $m;
 }
 
 =head1 SEE ALSO

Modified: trunk/t/mirror/sync-replicate.t
==============================================================================
--- trunk/t/mirror/sync-replicate.t	(original)
+++ trunk/t/mirror/sync-replicate.t	Sat Jan  6 07:46:36 2007
@@ -5,7 +5,7 @@
 use SVN::Ra;
 use SVK::Mirror::Backend::SVNSync;
 plan skip_all => "no replay" unless SVK::Mirror::Backend::SVNSync->has_replay_api;
-plan tests => 3;
+plan tests => 4;
 my ($xd, $svk) = build_test('test');
 my ($copath, $corpath) = get_copath ('sync-replicate');
 
@@ -42,3 +42,18 @@
 	  'Syncing '.$uri,
 	  'Retrieving log information from 7 to 7',
 	  'Committed revision 7 from revision 7.']);
+
+$svk->co('//fnord', $copath);
+
+
+overwrite_file("$copath/addedfile.txt", "fnord\n");
+
+$svk->add("$copath/addedfile.txt");
+is_output($svk, 'ci', [-m => 'fnord', $copath],
+	  ['Commit into mirrored path: merging back directly.',
+	   "Merging back to mirror source $uri.",
+	   'Merge back committed as revision 8.',
+	   "Syncing $uri",
+	   'Retrieving log information from 8 to 8',
+	   'Committed revision 8 from revision 8.']);
+


More information about the svk-commit mailing list