[svk-commit] r2374 - in trunk: lib/SVK t
nobody at bestpractical.com
nobody at bestpractical.com
Sun Apr 8 00:24:11 EDT 2007
Author: clkao
Date: Sun Apr 8 00:24:09 2007
New Revision: 2374
Added:
trunk/t/07smerge-cpdelete.t
Modified:
trunk/lib/SVK/Inspector/Root.pm
trunk/lib/SVK/Merge.pm
trunk/lib/SVK/Path.pm
Log:
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: trunk/lib/SVK/Inspector/Root.pm
==============================================================================
--- trunk/lib/SVK/Inspector/Root.pm (original)
+++ trunk/lib/SVK/Inspector/Root.pm Sun Apr 8 00:24:09 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: trunk/lib/SVK/Merge.pm
==============================================================================
--- trunk/lib/SVK/Merge.pm (original)
+++ trunk/lib/SVK/Merge.pm Sun Apr 8 00:24:09 2007
@@ -522,8 +522,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: trunk/lib/SVK/Path.pm
==============================================================================
--- trunk/lib/SVK/Path.pm (original)
+++ trunk/lib/SVK/Path.pm Sun Apr 8 00:24:09 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: trunk/t/07smerge-cpdelete.t
==============================================================================
--- (empty file)
+++ trunk/t/07smerge-cpdelete.t Sun Apr 8 00:24:09 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