[svk-commit] r2345 - in branches/2.0-releng: lib/SVK lib/SVK/Editor
t
nobody at bestpractical.com
nobody at bestpractical.com
Wed Mar 14 22:02:51 EDT 2007
Author: clkao
Date: Wed Mar 14 22:02:50 2007
New Revision: 2345
Added:
branches/2.0-releng/t/07smerge-rename2.t
Modified:
branches/2.0-releng/MANIFEST
branches/2.0-releng/lib/SVK/Editor/Copy.pm
branches/2.0-releng/lib/SVK/Merge.pm
Log:
Merge from trunk:
r2323 at trunk: clkao | 2007-03-14 12:37:53 +0000
Fix a bug when merging a copy that happened on an intermediate branch,
which might not map back to the merge destination.
Test submitted by: Bernhard K. Weißhuhn <bkw at weisshuhn.de>
Modified: branches/2.0-releng/MANIFEST
==============================================================================
--- branches/2.0-releng/MANIFEST (original)
+++ branches/2.0-releng/MANIFEST Wed Mar 14 22:02:50 2007
@@ -212,6 +212,7 @@
t/07smerge-prop.t
t/07smerge-relayed.t
t/07smerge-rename.t
+t/07smerge-rename2.t
t/07smerge-rename-dest.t
t/07smerge-tags.t
t/07smerge-to-from.t
Modified: branches/2.0-releng/lib/SVK/Editor/Copy.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Editor/Copy.pm (original)
+++ branches/2.0-releng/lib/SVK/Editor/Copy.pm Wed Mar 14 22:02:50 2007
@@ -154,9 +154,10 @@
my ($src_from, $to) = map {$_->revision_root_revision}
($fromroot, $toroot);
- # don't care, too early
+ # Make sure the copy happens not solely within the range of this merge.
my ($base_rev);
for my $try (@$copyboundry_rev) {
+ $logger->debug("to $to, from $src_from, try $try");
if ($try < $to) {
$base_rev = $try;
last;
@@ -164,6 +165,7 @@
}
return unless $base_rev;
+ { # if the copy source is out side of our branch
my $hate_path = $self->{src}->path_anchor;
if ($src_frompath !~ m{^\Q$hate_path/}) {
if (my ($frompath, $from) = $self->{cb_resolve_copy}->($path, $replace, $src_frompath, $src_from)) {
@@ -176,6 +178,7 @@
}
return unless $src_frompath =~ m{^\Q$hate_path/};
+ }
if ($self->{merge}->_is_merge_from
($self->{src}->path, $self->{dst}, $to)) {
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 Wed Mar 14 22:02:50 2007
@@ -592,7 +592,8 @@
my ($dst_from, $dst_fromrev) =
$self->resolve_copy($srcinfo, $dstinfo, @_);
return unless defined $dst_from;
-
+ # ensure the dst from path exists
+ return unless $self->{dst}->root->fs->revision_root($dst_fromrev)->check_path($dst_from);
# Because the delta still need to carry the copy
# information of the source, make merge editor note
# the mapping so it can do the translation
Added: branches/2.0-releng/t/07smerge-rename2.t
==============================================================================
--- (empty file)
+++ branches/2.0-releng/t/07smerge-rename2.t Wed Mar 14 22:02:50 2007
@@ -0,0 +1,43 @@
+#!/usr/bin/perl -w
+
+# testing smerge copies happened in intermediate branch which the
+# sourcemight not map to something sensible
+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-rename2');
+my ($repospath, undef, $repos) = $xd->find_repos ('//', 1);
+my $uuid = $repos->fs->get_uuid;
+
+$svk->mkdir ('-m', 'trunk', '//trunk');
+$svk->mkdir ('-m', 'trunk', '//branches');
+$svk->cp(-m => 'newbranch', '//trunk', '//branches/newbranch');
+$svk->checkout ('//branches/newbranch', $copath);
+
+chdir($copath);
+$svk->mkdir('dir_added_in_newbranch');
+overwrite_file('dir_added_in_newbranch/file_added_in_newbranch', 'foo');
+$svk->add('dir_added_in_newbranch/file_added_in_newbranch');
+$svk->ci(-m => "New files in newbranch");
+
+$svk->copy(-m => "second copy", '//branches/newbranch', '//branches/branchcopy');
+
+
+$svk->switch('//branches/branchcopy');
+
+$svk->move('dir_added_in_newbranch/file_added_in_newbranch', 'dir_added_in_newbranch/file_moved_in_branchcopy');
+
+$svk->commit(-m => "Renamed file in branchcopy");
+
+is_output($svk, 'smerge', ['--sync', '--log', '--message', "Merge branchcopy back into trunk", '--remoterev', '//branches/branchcopy', '//trunk'],
+ ['Auto-merging (0, 6) /branches/branchcopy to /trunk (base /trunk:1).',
+ 'A dir_added_in_newbranch',
+ 'A dir_added_in_newbranch/file_moved_in_branchcopy',
+ "New merge ticket: $uuid:/branches/branchcopy:6",
+ "New merge ticket: $uuid:/branches/newbranch:4",
+ 'Committed revision 7.']);
More information about the svk-commit
mailing list