[svk-commit] r2480 - in branches/2.0-releng: lib/SVK/Inspector t

nobody at bestpractical.com nobody at bestpractical.com
Tue Jul 17 11:07:39 EDT 2007


Author: clkao
Date: Tue Jul 17 11:07:39 2007
New Revision: 2480

Added:
   branches/2.0-releng/t/07smerge-cpdelete.t
Modified:
   branches/2.0-releng/lib/SVK/Inspector/Root.pm
   branches/2.0-releng/lib/SVK/Merge.pm
   branches/2.0-releng/lib/SVK/Path.pm

Log:
merge from trunk:
 r2374 at trunk:  clkao | 2007-04-08 05:24:09 +0100
 Fix a bug that deletes inside copies aren't properly merged
 across branches even the status output says so.
 
 This is caused by not supplying the inspector of the txn.  The
 same problem is still there when merging to a mirror.
 


Modified: branches/2.0-releng/lib/SVK/Inspector/Root.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Inspector/Root.pm	(original)
+++ branches/2.0-releng/lib/SVK/Inspector/Root.pm	Tue Jul 17 11:07:39 2007
@@ -58,9 +58,18 @@
 	SVK::Inspector
 };
 
-__PACKAGE__->mk_accessors(qw{root anchor});
+__PACKAGE__->mk_accessors(qw{txn anchor});
 
 
+my $root_accessor = __PACKAGE__->make_accessor('root');
+
+sub root {
+    if ($_[0]{txn}) {
+	return $_[0]{txn}->root;
+    }
+    goto $root_accessor;
+}
+
 sub exist {
     my ($self, $path, $pool) = @_;
     $path = $self->_anchor_path($path);

Modified: branches/2.0-releng/lib/SVK/Merge.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Merge.pm	(original)
+++ branches/2.0-releng/lib/SVK/Merge.pm	Tue Jul 17 11:07:39 2007
@@ -521,8 +521,13 @@
     $storage = $self->track_rename ($storage, \%cb)
 	if $self->{track_rename};
 
-    $cb{inspector} = $self->{dst}->inspector
-	unless ref($cb{inspector}) eq 'SVK::Inspector::Compat' ;
+    # XXX: this should be removed when cmerge is gone. also we should
+    # use the inspector of the txn we are working on, rather than of
+    # the (static) target
+
+    # $cb{inspector} = $self->{dst}->inspector
+    # unless ref($cb{inspector}) eq 'SVK::Inspector::Compat' ;
+
     my $meditor = SVK::Editor::Merge->new
 	( anchor => $src->path_anchor,
 	  repospath => $src->repospath, # for stupid copyfrom url

Modified: branches/2.0-releng/lib/SVK/Path.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Path.pm	(original)
+++ branches/2.0-releng/lib/SVK/Path.pm	Tue Jul 17 11:07:39 2007
@@ -224,10 +224,10 @@
 
     my $root_baserev = $m ? $m->fromrev : $yrev;
 
-    my $inspector = $self->inspector;
 
     if ($arg{check_only}) {
-	return (SVN::Delta::Editor->new, $inspector,
+	# XXX: use txn-based inspector as well.
+	return (SVN::Delta::Editor->new, $self->inspector,
 	        cb_rev => sub { $root_baserev },
 	        mirror => $m);
     }
@@ -253,7 +253,8 @@
 	my ($base_rev, $editor) = $m->get_merge_back_editor
 	    ($mpath, $arg{message}, $mcallback);
 	$editor->{_debug}++ if $logger->is_debug();
-	return ($editor, $inspector,
+	# XXX: fix me, need local knowledge about txn as well
+	return ($editor, $self->inspector,
 		mirror => $m,
 		post_handler => \$post_handler,
 		cb_rev => sub { $root_baserev }, #This is the inspector baserev
@@ -268,6 +269,14 @@
     my $txn = $arg{txn} || $self->repos->fs_begin_txn_for_commit
 	($yrev, $arg{author}, $arg{message});
 
+    # for some reasons, we can't use the txn root got here in
+    # inspector, the modified nodes aren't reflected.  Instead, we
+    # need to recreate the root from txn every time.
+    my $inspector = SVK::Inspector::Root->new
+	({ txn    => $txn,
+	   _pool  => $self->pool,
+	   anchor => $self->path_anchor });
+
     $txn->change_prop('svk:commit', '*')
 	if $fs->revision_prop(0, 'svk:notify-commit');
 

Added: branches/2.0-releng/t/07smerge-cpdelete.t
==============================================================================
--- (empty file)
+++ branches/2.0-releng/t/07smerge-cpdelete.t	Tue Jul 17 11:07:39 2007
@@ -0,0 +1,31 @@
+#!/usr/bin/perl -w
+use Test::More tests => 2;
+use strict;
+use File::Path;
+use SVK::Test;
+
+# test for merging a cp with deletion inside
+my ($xd, $svk) = build_test();
+our $output;
+my ($copath, $corpath) = get_copath('smerge-cpdelete');
+my $depot = $xd->find_depot('');
+$svk->mkdir ('-m', 'trunk', '//trunk');
+my $tree = create_basic_tree ($xd, '//trunk');
+$svk->cp ('-m', 'branch', '//trunk', '//local');
+
+$svk->cp(-m => 'cp B', '//trunk/B' => '//trunk/B-cp');
+$svk->rm(-m => 'rm B/fe', '//trunk/B-cp/fe');
+$svk->mkdir(-m => 'new dir', '//trunk/Anewdir');
+is_output($svk, 'smerge', [-m => 'merge cp with delete', -t => '//local'],
+	  ['Auto-merging (3, 7) /trunk to /local (base /trunk:3).',
+	   'A + B-cp',
+	   'D   B-cp/fe',
+	   'A   Anewdir',
+	   qr'New merge ticket: .*:/trunk:7',
+	   'Committed revision 8.']);
+
+is_output($svk, 'ls', ['//local/B-cp'],
+	  ['S/'], 'fe should be deleted in local as well');
+# XXX test merging to mirror.
+
+


More information about the svk-commit mailing list