[svk-commit] r3149 - in trunk: lib/SVK/Editor t/mirror

nobody at bestpractical.com nobody at bestpractical.com
Tue Feb 24 09:01:05 EST 2009


Author: clkao
Date: Tue Feb 24 09:01:04 2009
New Revision: 3149

Added:
   trunk/t/mirror/sync-edge-subtree.t
Modified:
   trunk/MANIFEST
   trunk/lib/SVK/Editor/SubTree.pm

Log:
Fix an edge case where moved mirroring source causes the
subtree editor to bus error.


Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	(original)
+++ trunk/MANIFEST	Tue Feb 24 09:01:04 2009
@@ -346,6 +346,7 @@
 t/mirror/sync-bootstrap-resume.t
 t/mirror/sync-bootstrap.t
 t/mirror/sync-crazy-replace.t
+t/mirror/sync-edge-subtree.t
 t/mirror/sync-empty.t
 t/mirror/sync-escape.t
 t/mirror/sync-failed-hook.t

Modified: trunk/lib/SVK/Editor/SubTree.pm
==============================================================================
--- trunk/lib/SVK/Editor/SubTree.pm	(original)
+++ trunk/lib/SVK/Editor/SubTree.pm	Tue Feb 24 09:01:04 2009
@@ -81,10 +81,16 @@
 	    ++$self->{needs_touch} if $func eq 'add_directory';
 	    return $self->anchor_baton;
 	}
-	return $self->anchor_baton unless $arg[0] =~ s{^\Q$self->{anchor}/}{};
+	unless ($arg[0] =~ s{^\Q$self->{anchor}/}{}) {
+            return undef;
+            return $func =~ m/file$/ ? undef : $self->anchor_baton;
+        }
     }
     elsif ($func =~ m/^close_(?:file|directory)/) {
+	return unless defined $arg[0];
 	return if $arg[0] eq $self->anchor_baton;
+    }
+    elsif ($func ne 'close_edit') {
 	return unless defined $arg[0];
     }
 

Added: trunk/t/mirror/sync-edge-subtree.t
==============================================================================
--- (empty file)
+++ trunk/t/mirror/sync-edge-subtree.t	Tue Feb 24 09:01:04 2009
@@ -0,0 +1,44 @@
+#!/usr/bin/perl -w
+use strict;
+use Test::More;
+use SVK::Test;
+eval { require SVN::Mirror; 1 } or plan skip_all => 'require SVN::Mirror';
+plan tests => 2;
+
+my ($xd, $svk) = build_test('test');
+
+our $output;
+
+$svk->mkdir(-pm => 'init', '/test/i/a/trunk/ac');
+my $tree = create_basic_tree ($xd, '/test/i/a/trunk/ac');
+$svk->mkdir(-pm => 'prepare to reorg', '/test/i/a/ac');
+$svk->mv(-pm => 'reorg', '/test/i/a/trunk/ac' => '/test/i/a/ac/trunk');
+$svk->rm(-pm => 'remove old trunk', '/test/i/a/trunk');
+$svk->mkdir(-pm => 'some other things', '/test/i/a/useless');
+create_basic_tree ($xd, '/test/i/a/useless');
+$svk->mv(-pm => 'to toplevel', '/test/i/a' => '/test/a');
+
+$svk->cp(-pm => 'to toplevel', '/test/a/ac/trunk' => '/test/a/ac/branches/baz');
+
+my ($copath, $corpath) = get_copath();
+
+$svk->checkout('/test/a/ac/trunk', $copath);
+
+append_file("$corpath/B/fe", "moose\n");
+$svk->ci(-m => 'some changes', $copath);
+
+my ($srepospath, $spath, $srepos) = $xd->find_repos ('/test/a/ac', 1);
+my $uri = uri($srepospath.($spath eq '/' ? '' : $spath));
+
+$svk->mi('//mirror/proj', $uri);
+
+is_output($svk, 'sync', ['//mirror/proj'],
+          ["Syncing $uri",
+           'Retrieving log information from 1 to 11',
+           'Committed revision 2 from revision 9.',
+           'Committed revision 3 from revision 10.',
+           'Committed revision 4 from revision 11.',
+       ]);
+
+is_ancestor($svk, "//mirror/proj/branches/baz", "/mirror/proj/trunk", 2);
+


More information about the svk-commit mailing list