[svk-commit] r2332 - in branches/2.0-releng: lib/SVK/Editor t

nobody at bestpractical.com nobody at bestpractical.com
Wed Mar 14 20:19:48 EDT 2007


Author: clkao
Date: Wed Mar 14 20:19:48 2007
New Revision: 2332

Added:
   branches/2.0-releng/t/07smerge-rename-dest.t
Modified:
   branches/2.0-releng/MANIFEST
   branches/2.0-releng/lib/SVK/Editor/Merge.pm

Log:
Merge from trunk:
 r2298 at trunk:  clkao | 2007-02-12 12:26:57 +0000
 Fix a pool usage in Editor::Merge::apply_textdelta, which has a side-effect
 causing rename-tracking smerge on a new file inside a renamed directory to
 fail with SWIG-runtime error.
 
 Reported by: Viktor Štujber <theultramage at gmail.com>
 


Modified: branches/2.0-releng/MANIFEST
==============================================================================
--- branches/2.0-releng/MANIFEST	(original)
+++ branches/2.0-releng/MANIFEST	Wed Mar 14 20:19:48 2007
@@ -210,6 +210,7 @@
 t/07smerge-prop.t
 t/07smerge-relayed.t
 t/07smerge-rename.t
+t/07smerge-rename-dest.t
 t/07smerge-to-from.t
 t/07smerge-tree.t
 t/07smerge-upload.t

Modified: branches/2.0-releng/lib/SVK/Editor/Merge.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Editor/Merge.pm	(original)
+++ branches/2.0-releng/lib/SVK/Editor/Merge.pm	Wed Mar 14 20:19:48 2007
@@ -404,14 +404,14 @@
 }
 
 sub apply_textdelta {
-    my ($self, $path, $checksum, $pool) = @_;
+    my ($self, $path, $checksum, $ppool) = @_;
     return unless $path;
 
     my $info = $self->{info}{$path};
     my ($basepath, $fromrev) = $info->{baseinfo} ? @{$info->{baseinfo}} : ($path);
     my $fh = $info->{fh} = {};
-    if (($pool = $info->{fpool}) &&
-	($fh->{local} = $self->inspector->localmod($basepath, $checksum || '', $pool))) {
+    my $pool = $info->{fpool};
+    if ($pool && ($fh->{local} = $self->inspector->localmod($basepath, $checksum || '', $pool))) {
 	# retrieve base
 	unless ($info->{addmerge}) {
 	    $fh->{base} = [$self->_retrieve_base($path, $pool)];
@@ -426,7 +426,7 @@
     $self->ensure_open ($path);
 
     my $handle = $self->{storage}->apply_textdelta ($self->{storage_baton}{$path},
-						    $checksum, $pool);
+						    $checksum, $ppool);
 
     if ($self->{storage_has_unwritable} && !$handle) {
 	delete $self->{notify}{status}{$path};

Added: branches/2.0-releng/t/07smerge-rename-dest.t
==============================================================================
--- (empty file)
+++ branches/2.0-releng/t/07smerge-rename-dest.t	Wed Mar 14 20:19:48 2007
@@ -0,0 +1,44 @@
+#!/usr/bin/perl -w
+use Test::More tests => 2;
+use strict;
+use File::Path;
+use Cwd;
+use SVK::Test;
+
+my ($xd, $svk) = build_test();
+our $output;
+my ($copath, $corpath) = get_copath ('smerge-moved-dest');
+$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/A";
+mkdir "$copath/A/deep";
+overwrite_file("$copath/A/foo", "foobar\n");
+overwrite_file("$copath/A/deep/foo", "foobar\n");
+
+$svk->add("$copath/A");
+$svk->commit ('-m', 'init', "$copath");
+$svk->cp('-m', 'branch', '//trunk', '//local');
+
+overwrite_file("$copath/A/foo", "foobar changed\n");
+overwrite_file("$copath/A/deep/bar", "foobar\n");
+
+$svk->add("$copath/A/deep/bar");
+$svk->ci(-m => 'change on trunk', $copath);
+$svk->mv('-m', 'move foo', '//local/A', '//local/A-away');
+is_output($svk, 'sm', [-m => 'merge', '//trunk', '//local'],
+	  ['Auto-merging (2, 4) /trunk to /local (base /trunk:2).',
+	   '    A - skipped',
+	   '    A/foo - skipped',
+	   'Empty merge.']);
+
+is_output($svk, 'sm', ['--track-rename', -m => 'merge', '//trunk', '//local'],
+	  ['Auto-merging (2, 4) /trunk to /local (base /trunk:2).',
+	   'Collecting renames, this might take a while.',
+	   'U   A/foo - A-away/foo',
+	   'A   A/deep/bar - A-away/deep/bar',
+	   qr'New merge ticket: .*:/trunk:4',
+	   'Committed revision 6.']);
+


More information about the svk-commit mailing list