[svk-commit] r2387 - in trunk: lib/SVK lib/SVK/Command t

nobody at bestpractical.com nobody at bestpractical.com
Sat May 5 02:23:09 EDT 2007


Author: clkao
Date: Sat May  5 02:23:07 2007
New Revision: 2387

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

Log:
Make smerge work correctly when renamed entries are to be
merged back, where those entries are previously text-merged
with --track-renames.


Modified: trunk/lib/SVK/Command/Diff.pm
==============================================================================
--- trunk/lib/SVK/Command/Diff.pm	(original)
+++ trunk/lib/SVK/Command/Diff.pm	Sat May  5 02:23:07 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: trunk/lib/SVK/Editor/Copy.pm
==============================================================================
--- trunk/lib/SVK/Editor/Copy.pm	(original)
+++ trunk/lib/SVK/Editor/Copy.pm	Sat May  5 02:23:07 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);
 	}
@@ -363,7 +365,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: trunk/lib/SVK/Merge.pm
==============================================================================
--- trunk/lib/SVK/Merge.pm	(original)
+++ trunk/lib/SVK/Merge.pm	Sat May  5 02:23:07 2007
@@ -604,6 +604,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;
@@ -622,10 +626,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
+		  my ($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: trunk/t/07smerge-rename3.t
==============================================================================
--- trunk/t/07smerge-rename3.t	(original)
+++ trunk/t/07smerge-rename3.t	Sat May  5 02:23:07 2007
@@ -84,30 +84,23 @@
 # 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');
 
+TODO: {
+todo_skip 'not working', 4;
+
 
 # adding a new dir on trunk
 $svk->mkdir('foo');


More information about the svk-commit mailing list