[svk-devel] smerge crash (+ patch, tests, other crash)
Daniel Jacobowitz
drow at false.org
Fri Feb 23 16:19:21 EST 2007
We tried to smerge from a branch where a file had been moved from one
directory to another. SVK 2.0.0 and trunk crash; it tried to open a
base file in the root of the checkout when the file was really in a
subdirectory. I think the patch below is correct for that case;
apply_textdelta ought to get the baton returned by open_file.
Unfortunately the first of the two testcases I wrote for this problem
still fails and I can't figure out what's going on (end of
07smerge-rename.t). It now reports:
t/07smerge-rename................ok 1/3 (in cleanup) Svndiff data ends unexpectedly: Unexpected end of svndiff input
# $got->[14] = 'Incomplete data: Delta source ended unexpectedly'
That's because it tries to feed an empty stream as the base when the
delta says it expects seven bytes of input. I think this is a similar
problem, but I'd appreciate help fixing it.
(I don't get how no one's encountered this bug before... does no one
use svn rename and svk smerge together?)
Index: lib/SVK/Editor/XD.pm
===================================================================
--- lib/SVK/Editor/XD.pm (revision 2300)
+++ lib/SVK/Editor/XD.pm (working copy)
@@ -334,7 +334,7 @@ sub _schedule_entry {
$editor->{master_editor} = SVK::Editor::Checkout->new(%$self);
if (defined $editor->{target}) {
# XXX: depot_delta can't generate single file fulltext.
- my $handle = $editor->apply_textdelta($editor->{target},
+ my $handle = $editor->apply_textdelta($editor->{target_baton},
$from_root->file_md5_checksum($copyfrom));
if ($handle && $#{$handle} >= 0) {
if ($self->{send_fulltext}) {
Index: t/07smerge-moved.t
===================================================================
--- t/07smerge-moved.t (revision 0)
+++ t/07smerge-moved.t (revision 0)
@@ -0,0 +1,33 @@
+#!/usr/bin/perl -w
+use Test::More tests => 1;
+use strict;
+use File::Path;
+use Cwd;
+use SVK::Test;
+
+my ($xd, $svk) = build_test();
+our $output;
+my ($copath, $corpath) = get_copath ('smerge-moved');
+$svk->mkdir ('-m', 'trunk', '//trunk');
+$svk->checkout ('//trunk', $copath);
+my ($repospath, undef, $repos) = $xd->find_repos ('//', 1);
+my $uuid = $repos->fs->get_uuid;
+
+mkdir "$copath/";
+mkdir "$copath/deep";
+overwrite_file ("$copath/foo", "foobar\n");
+$svk->add ("$copath/foo", "$copath/deep");
+$svk->commit ('-m', 'init', "$copath");
+
+$svk->cp ('-m', 'branch', '//trunk', '//local');
+
+$svk->mv ('-m', 'move foo', '//trunk/foo', '//trunk/deep/foo');
+
+($copath, $corpath) = get_copath ('smerge-moved');
+$svk->checkout ('//local', $copath);
+
+is_output ($svk, 'smerge', ['//trunk', $copath],
+ ['Auto-merging (2, 4) /trunk to /local (base /trunk:2).',
+ __("A + $copath/deep/foo"),
+ __("D $copath/foo"),
+ "New merge ticket: $uuid:/trunk:4"]);
Index: t/07smerge-rename.t
===================================================================
--- t/07smerge-rename.t (revision 2300)
+++ t/07smerge-rename.t (working copy)
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
-use Test::More tests => 2;
+use Test::More tests => 3;
use strict;
use File::Path;
use Cwd;
@@ -55,3 +55,24 @@ is_output ($svk, 'smerge', ['--track-ren
qr'New merge ticket: .*:/trunk:8',
'Empty merge.',
'2 conflicts found.']);
+
+my ($lcopath, $lcorpath) = get_copath ('smerge-moved');
+$svk->checkout ('//local', $lcopath);
+is_output ($svk, 'smerge', ['--track-rename', '//trunk', $lcopath],
+ ['Auto-merging (2, 8) /trunk to /local (base /trunk:2).',
+ 'Collecting renames, this might take a while.',
+ __("A + $lcopath/A/deep.new"),
+ __("U $lcopath/A/deep.new/foo"),
+ __("A + $lcopath/A/deep.new/bar"),
+ __("U $lcopath/A/normal"),
+ __("A + $lcopath/A/foo.new"),
+ __("D $lcopath/A/bar"),
+ __("C $lcopath/A/deep"),
+ __("D $lcopath/A/deep/foo"),
+ __("C $lcopath/A/deep/test.pl"),
+ __("D $lcopath/A/foo"),
+ __("U $lcopath/test.pl - A/deep/test.pl"),
+ "New merge ticket: $uuid:/trunk:8",
+ 'Empty merge.',
+ '2 conflicts found.']);
+
--
Daniel Jacobowitz
CodeSourcery
More information about the svk-devel
mailing list