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

nobody at bestpractical.com nobody at bestpractical.com
Tue Jul 17 11:27:38 EDT 2007


Author: clkao
Date: Tue Jul 17 11:27:37 2007
New Revision: 2483

Modified:
   branches/2.0-releng/lib/SVK/Command/Diff.pm
   branches/2.0-releng/lib/SVK/Editor/Copy.pm
   branches/2.0-releng/lib/SVK/Merge.pm
   branches/2.0-releng/t/07smerge-rename3.t

Log:
merge from trunk:

 r2387 at trunk:  clkao | 2007-05-05 07:23:14 +0100
 Make smerge work correctly when renamed entries are to be
 merged back, where those entries are previously text-merged
 with --track-renames.
 
 r2388 at trunk:  clkao | 2007-05-05 07:29:54 +0100
 Remove a warning.
 r2389 at trunk:  clkao | 2007-05-05 07:41:21 +0100
 All tests pass now for smerge-rename3.


Modified: branches/2.0-releng/lib/SVK/Command/Diff.pm
==============================================================================
--- branches/2.0-releng/lib/SVK/Command/Diff.pm	(original)
+++ branches/2.0-releng/lib/SVK/Command/Diff.pm	Tue Jul 17 11:27:37 2007
@@ -183,7 +183,7 @@
 	      src => $target2,
 	      dst => $target2,
 	      cb_resolve_copy => sub {
-		  my ($cp_path, $cp_rev) = @_;
+		  my (undef, undef, $cp_path, $cp_rev) = @_;
 		  return ($cp_path, $cp_rev);
 	      }) unless $self->{expand};
 

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	Tue Jul 17 11:27:37 2007
@@ -141,7 +141,7 @@
 
 	# don't use the same copy twice
 	if (exists $self->{incopy}[-1]) {
-	    if ($src_frompath =~ m{^\Q$self->{incopy}[-1]{frompath}/}) {
+	    if ($src_frompath =~ m{^\Q$self->{incopy}[-1]{src_frompath}/}) {
 		return;
 		# XXX: It doesn't seem right to fallback to previous
 		# copies from the one we don't want.  But make sure
@@ -170,8 +170,9 @@
 	if ($src_frompath !~ m{^\Q$hate_path/}) {
 	    if (my ($frompath, $from) = $self->{cb_resolve_copy}->($path, $replace, $src_frompath, $src_from)) {
 		push @{$self->{incopy}}, { path => $path,
-					   fromrev => $src_from,
-					   frompath => $src_frompath };
+					   fromrev => $from,
+					   src_frompath => $src_frompath,
+					   frompath => $frompath };
 		return $self->copy_source($src_frompath, $src_from);
 	    }
 	    return;
@@ -205,8 +206,9 @@
 	$logger->debug("==> $path(:$to) is copied from $src_frompath:$src_from");
 	if (my ($frompath, $from) = $self->{cb_resolve_copy}->($path, $replace, $src_frompath, $src_from)) {
 	    push @{$self->{incopy}}, { path => $path,
-				       fromrev => $src_from,
-				       frompath => $src_frompath };
+				       fromrev => $from,
+				       src_frompath => $src_frompath,
+				       frompath => $frompath };
 	    $logger->debug("==> resolved to $frompath:$from");
 	    return $self->copy_source($src_frompath, $src_from);
 	}
@@ -369,7 +371,7 @@
 	      newroot => $self->{src}->root,
 	      oldpath => [$src_anchor, $src_target],
 	      newpath => File::Spec::Unix->catdir($self->{src}->path_anchor, $path),
-	      editor => SVN::Delta::Editor->new(_debug => 1)) if $logger->is_debug();
+	      editor => SVK::Editor->new(_debug => 1)) if $logger->is_debug();
     $logger->debug("==> done sample");
     SVK::XD->depot_delta
 	    ( oldroot => $self->{copyboundry_root}->fs->

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:27:37 2007
@@ -603,6 +603,10 @@
 ),
 	      src => $src,
 	      dst => $self->{dst},
+	      cb_query_copy => sub {
+		  my ($from, $rev) = @_;
+		  return @{$meditor->{copy_info}{$from}{$rev}};
+	      },
 	      cb_resolve_copy => sub {
 		  my $path = shift;
 		  my $replace = shift;
@@ -621,10 +625,12 @@
 		  # 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
+		  ($dst_from, $dst_fromrev) =
+		      ($dst_path->path, $dst_path->revision);
 		  $meditor->copy_info($src_from, $src_fromrev,
-				      $dst_path->path, $dst_path->revision);
+				      $dst_from, $dst_fromrev);
 
-		  return ($src_from, $src_fromrev);
+		  return ($dst_from, $dst_fromrev);
 	      } );
 	  $editor = SVK::Editor::Delay->new ($editor);
 	}

Modified: branches/2.0-releng/t/07smerge-rename3.t
==============================================================================
--- branches/2.0-releng/t/07smerge-rename3.t	(original)
+++ branches/2.0-releng/t/07smerge-rename3.t	Tue Jul 17 11:27:37 2007
@@ -84,31 +84,20 @@
 # Merge changes w/rename from trunk to branch
 # NOTE: This expected output might not be completely correct!
 
-#$answer = ['d', 's'];
-#$answer = 's'; # skip
-#$ENV{SVKRESOLVE} = 'd'; # diff
-TODO: {
-$TODO = "merging renamed change back should have proper base.";
-
 is_output ($svk, 'smerge', ['//branches/newbranch', '//trunk', '--track-rename', '-m', 'merge back'], [
     'Auto-merging (0, 10) /branches/newbranch to /trunk (base /trunk:8).',
     'Collecting renames, this might take a while.',
     'A + module2',
     'U   module2/test.txt',
     'D   module',
-    "New merge ticket: $uuid:/trunk:9",
-    'Committed revision 9.',
+    "New merge ticket: $uuid:/branches/newbranch:10",
+    'Committed revision 11.',
 ]);
-}
-
-TODO: {
-todo_skip 'not working', 5;
 
 chdir($co_trunk_path);
 $svk->update();
 is_file_content('module2/test.txt', '34');
 
-
 # adding a new dir on trunk
 $svk->mkdir('foo');
 overwrite_file('foo/test.txt', 'a');
@@ -117,12 +106,12 @@
 
 # Merge changes w/rename from trunk to branch
 is_output ($svk, 'smerge', ['//trunk', '//branches/newbranch', '--track-rename', '-m', 'merge 3'], [
-    'Auto-merging (6, 10) /trunk to /branches/newbranch (base /trunk:6).',
+    'Auto-merging (8, 12) /trunk to /branches/newbranch (base /branches/newbranch:10).',
     'Collecting renames, this might take a while.',
     'A   foo',
     'A   foo/test.txt',
-    "New merge ticket: $uuid:/trunk:10",
-    'Committed revision 11.',
+    "New merge ticket: $uuid:/trunk:12",
+    'Committed revision 13.',
 ]);
 
 chdir($co_branch_path);
@@ -134,16 +123,16 @@
 $svk->ci(-m => "test 6 - renamed and changed");
 
 is_output ($svk, 'smerge', ['//branches/newbranch', '//trunk', '--track-rename', '-m', 'merge back'], [
-    'Auto-merging (0, 12) /branches/newbranch to /trunk (base /trunk:10).',
+    'Auto-merging (10, 14) /branches/newbranch to /trunk (base /trunk:12).',
     'Collecting renames, this might take a while.',
-    'A   bar',
-    'A   bar/test.txt',
+    'A + bar',
+    'U   bar/test.txt',
     'D   foo',
-    "New merge ticket: $uuid:/trunk:10",
-    'Committed revision 13.',
+    "New merge ticket: $uuid:/branches/newbranch:14",
+    'Committed revision 15.',
 ]);
 
 chdir($co_trunk_path);
 $svk->update();
 is_file_content('bar/test.txt', 'b');
-}
+


More information about the svk-commit mailing list