[svk-commit] r2288 - in branches/2.0-releng: lib/SVK lib/SVK/Mirror/Backend

nobody at bestpractical.com nobody at bestpractical.com
Sat Jan 6 08:04:08 EST 2007


Author: clkao
Date: Sat Jan  6 08:04:06 2007
New Revision: 2288

Modified:
   branches/2.0-releng/lib/SVK/Mirror/Backend/SVNSync.pm
   branches/2.0-releng/lib/SVK/MirrorCatalog.pm
   branches/2.0-releng/t/mirror/sync-replicate.t

Log:
Merge from trunk:

 r2286 at trunk:  clkao | 2007-01-06 20:46:36 +0800
 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 /.
 
 r2287 at trunk:  clkao | 2007-01-06 21:01:58 +0800
 Fix a typo preventing mirror --relocate to work on mirrors on '/'.


Modified: branches/2.0-releng/lib/SVK/Mirror/Backend/SVNSync.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Mirror/Backend/SVNSync.pm	(original)
+++ branches/2.0-releng/lib/SVK/Mirror/Backend/SVNSync.pm	Sat Jan  6 08:04:06 2007
@@ -96,7 +96,7 @@
 
 sub _do_relocate {
     my ($self) = @_;
-    $self->mirror->depot->reposfs->change_rev_prop( 0, 'svn:svnsync:from-url',  $self->mirror->url );
+    $self->mirror->depot->repos->fs->change_rev_prop( 0, 'svn:svnsync:from-url',  $self->mirror->url );
 }
 
 sub find_rev_from_changeset { $_[1] }

Modified: branches/2.0-releng/lib/SVK/MirrorCatalog.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/MirrorCatalog.pm	(original)
+++ branches/2.0-releng/lib/SVK/MirrorCatalog.pm	Sat Jan  6 08:04:06 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: branches/2.0-releng/t/mirror/sync-replicate.t
==============================================================================
--- branches/2.0-releng/t/mirror/sync-replicate.t	(original)
+++ branches/2.0-releng/t/mirror/sync-replicate.t	Sat Jan  6 08:04:06 2007
@@ -5,9 +5,11 @@
 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 => 6;
 my ($xd, $svk) = build_test('test');
 my ($copath, $corpath) = get_copath ('sync-replicate');
+unlink('t/checkout/sync-replicate-repo');
+my ($ropath, $rorpath) = get_copath ('sync-replicate-repo');
 
 our $output;
 
@@ -42,3 +44,27 @@
 	  '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.']);
+
+SKIP: {
+skip 'No symlinks on win32', 2 if $^O eq 'MSWin32';
+symlink($srepospath, $rorpath);
+
+is_output($svk, 'mi', ['--relocate', '//', uri($rorpath)],
+	  ['Mirror relocated.']);
+is_output($svk, 'sync', ['//'],
+	  ['Syncing '.uri($rorpath)]);
+}


More information about the svk-commit mailing list