[svk-commit] r2377 - in trunk/lib/SVK: .

nobody at bestpractical.com nobody at bestpractical.com
Sun Apr 8 03:52:51 EDT 2007


Author: clkao
Date: Sun Apr  8 03:52:51 2007
New Revision: 2377

Modified:
   trunk/lib/SVK/Command/Commit.pm
   trunk/lib/SVK/Path.pm
   trunk/lib/SVK/XD.pm

Log:
Replace cb_resolve_rev in depot_delta with MapRev editor.

Modified: trunk/lib/SVK/Command/Commit.pm
==============================================================================
--- trunk/lib/SVK/Command/Commit.pm	(original)
+++ trunk/lib/SVK/Command/Commit.pm	Sun Apr  8 03:52:51 2007
@@ -600,6 +600,7 @@
     my ($self, $target, $xdroot, $editor, %cb) = @_;
     my $fs = $target->repos->fs;
     my %revcache;
+    my $mirror = $cb{mirror};
     $self->{xd}->checkout_delta
 	( $target->for_checkout_delta,
 	  depth => $self->{recursive} ? undef : 0,
@@ -616,16 +617,8 @@
 	    obstruct_as_replace => 1,
 	    absent_as_delete => 1) :
 	  ( absent_ignore => 1),
-	  cb_copyfrom => $cb{cb_copyfrom},
-	  $cb{mirror} ?
-	  (cb_resolve_rev => sub {
-	       my ($source_path, $source_rev) = @_;
-	       return $revcache{$source_rev} if exists $revcache{$source_rev};
-	       my ($rroot, $rsource_path) = $xdroot->get_revision_root($source_path, $source_rev);
-	       my $rev = ($rroot->node_history($rsource_path)->prev(0)->location)[1];
-
-	       $revcache{$source_rev} = $cb{mirror}->find_remote_rev($rev);
-	   }) : ());
+	  cb_copyfrom => $cb{cb_copyfrom}
+	);
     delete $self->{save_message};
     return;
 }

Modified: trunk/lib/SVK/Path.pm
==============================================================================
--- trunk/lib/SVK/Path.pm	(original)
+++ trunk/lib/SVK/Path.pm	Sun Apr  8 03:52:51 2007
@@ -253,6 +253,14 @@
 	my ($base_rev, $editor) = $m->get_merge_back_editor
 	    ($mpath, $arg{message}, $mcallback);
 	$editor->{_debug}++ if $logger->is_debug();
+	$editor = SVK::Editor::MapRev->new(
+          {   _editor        => [$editor],
+              cb_resolve_rev => sub {
+                  my ( $func, $rev ) = @_;
+                  return $func =~ m/^add/ ? $rev : $root_baserev;
+	      }
+          });
+
 	# XXX: fix me, need local knowledge about txn as well
 	return ($editor, $self->inspector,
 		mirror => $m,

Modified: trunk/lib/SVK/XD.pm
==============================================================================
--- trunk/lib/SVK/XD.pm	(original)
+++ trunk/lib/SVK/XD.pm	Sun Apr  8 03:52:51 2007
@@ -993,7 +993,7 @@
     my $entry = $arg->{cinfo};
     my $schedule = $entry->{'.schedule'} || '';
     # XXX: uncomment this as mutation coverage test
-    # return $cb_resolve_rev->($arg->{path}, $entry->{revision});
+    # return  $entry->{revision};
 
     # Lookup the copy source rev for the case of open_directory inside
     # add_directotry with history.  But shouldn't do so for replaced
@@ -1002,7 +1002,7 @@
 	$self->_copy_source($entry, $arg->{copath}) : ();
     ($source_path, $source_rev) = ($arg->{path}, $entry->{revision})
 	unless defined $source_path;
-    return $arg->{cb_resolve_rev}->($source_path, $source_rev);
+    return $source_rev;
 }
 
 sub _delta_content {
@@ -1514,18 +1514,16 @@
     $arg{editor} = SVK::Editor::Delay->new ($arg{editor})
 	   unless $arg{nodelay};
 
-    my $cb_resolve_rev = $arg{cb_resolve_rev} ||= sub { $_[1] };
     # XXX: translate $repospath to use '/'
     $arg{cb_copyfrom} ||= $arg{expand_copy} ? sub { (undef, -1) }
 	: sub { my $path = $_[0]; $path =~ s/%/%25/g; ("file://$repospath$path", $_[1]) };
-    my ($entry) = $self->get_entry($arg{copath}, 1);
-    my $rev = $arg{cb_resolve_rev}->($arg{path}, $entry->{revision});
     local $SIG{INT} = sub {
 	$arg{editor}->abort_edit;
 	die loc("Interrupted.\n");
     };
 
-    my $baton = $arg{editor}->open_root ($rev);
+    my ($entry) = $self->get_entry($arg{copath}, 1);
+    my $baton = $arg{editor}->open_root ($entry->{revision})
     $self->_delta_dir (%arg, baton => $baton, root => 1, base => 1, type => 'directory');
     $arg{editor}->close_directory ($baton);
     $arg{editor}->close_edit ();


More information about the svk-commit mailing list