[svk-commit] r3115 - in branches/delta-refactor/lib/SVK: Command

nobody at bestpractical.com nobody at bestpractical.com
Mon Nov 3 06:10:09 EST 2008


Author: clkao
Date: Mon Nov  3 06:10:09 2008
New Revision: 3115

Modified:
   branches/delta-refactor/lib/SVK/Command/Diff.pm
   branches/delta-refactor/lib/SVK/Delta.pm
   branches/delta-refactor/lib/SVK/DeltaOld.pm

Log:
- use new run_delta api for diff.
- move xdroot into compatargs.


Modified: branches/delta-refactor/lib/SVK/Command/Diff.pm
==============================================================================
--- branches/delta-refactor/lib/SVK/Command/Diff.pm	(original)
+++ branches/delta-refactor/lib/SVK/Command/Diff.pm	Mon Nov  3 06:10:09 2008
@@ -145,17 +145,20 @@
 	    ($report) = get_anchor (0, $report) if defined $report;
 	}
 	$editor->{report} = $report;
-	$self->{xd}->checkout_delta
-	    ( $target2->for_checkout_delta,
+        $target2->run_delta(
+            $editor,
+            {
+              use_old_delta => 1,
+              xdroot => $target2->create_xd_root,
+              base_root => $oldroot,
+              base_path => $target->path_anchor,
+	      $self->{recursive} ? () : (depth => 1),
 	      $self->{expand}
 	      ? ( expand_copy => 1 )
 	      : ( cb_copyfrom => sub { @_ } ),
-	      base_root => $oldroot,
-	      base_path => $target->path_anchor,
-	      xdroot => $target2->create_xd_root,
-	      editor => $editor,
-	      $self->{recursive} ? () : (depth => 1),
-	    );
+
+            }
+        );
     }
     else {
         my $kind = $oldroot->check_path($target->path_anchor);

Modified: branches/delta-refactor/lib/SVK/Delta.pm
==============================================================================
--- branches/delta-refactor/lib/SVK/Delta.pm	(original)
+++ branches/delta-refactor/lib/SVK/Delta.pm	Mon Nov  3 06:10:09 2008
@@ -72,14 +72,14 @@
 
     # objective: move behaviour-related info into $self, and pass around context only
     my $source = $target->source;
-    my $base_root = $target->create_xd_root;
+    my $base_root = $opt->{base_root} || $target->create_xd_root;
     my $base_kind = $base_root->check_path($source->path_anchor);
 
     die "checkout_delta called with non-dir node"
 	unless $base_kind == $SVN::Node::dir;
 
     my %arg = (
-		base_root_is_xd => 1,
+		base_root_is_xd => $opt->{xdroot} ? 0 : 1,
 		encoder => get_encoder,
 		kind => $base_kind,
 		base_kind => $base_kind,
@@ -147,12 +147,13 @@
         repospath => $source->repospath,
         report    => $target->report,
 
-		     cb_conflict => $self->cb_conflict,
-		     cb_unchanged => $self->cb_unchanged,
-		     cb_ignored => $self->cb_ignored,
+        cb_conflict => $self->cb_conflict,
+        cb_unchanged => $self->cb_unchanged,
+        cb_ignored => $self->cb_ignored,
 
         # compat for now
         editor => $editor,
+        xdroot => $base_root,
     );
 
 }
@@ -162,8 +163,7 @@
 
     my $source = $target->source;
     my %arg    = (
-        %$ctx,
-        xdroot    => $base_root,
+        %$ctx
     );
     my %compatarg = _compat_args(@_);
 
@@ -175,8 +175,7 @@
 
     my $source = $target->source;
     my %arg    = (
-        %$ctx,
-        xdroot    => $base_root,
+        %$ctx
     );
 
     my %compatarg = _compat_args(@_);
@@ -299,7 +298,7 @@
 			base => !$obs,
 			depth => defined $arg{depth} ? defined $targets ? $arg{depth} : $arg{depth} - 1: undef,
 			entry => $newentry,
-			kind => $arg{base_root_is_xd} ? $kind : $arg{xdroot}->check_path ($newpath),
+			kind => $arg{base_root_is_xd} ? $kind : $base_root->check_path ($newpath),
 			base_kind => $kind,
 			targets => $newtarget,
 			baton => $baton,
@@ -349,7 +348,7 @@
 			 targets => $newtarget, base_kind => $SVN::Node::none);
 	# XXX: what is this != thing in trinary?
 	$newpaths{kind} = $arg{base_root_is_xd} ? $SVN::Node::none :
-	    $arg{xdroot}->check_path($target->path_anchor) != $SVN::Node::none;
+	    $base_root->check_path($target->path_anchor) != $SVN::Node::none;
 	my ($ccinfo, $sche) = $self->_compose_cinfo($entry_target);
 
 	my $add = $sche || $arg{auto_add} || $newpaths{kind};
@@ -380,7 +379,7 @@
 	my ($type, $st) = _node_type($entry_target->copath) or next;
 	my $delta = $type eq 'directory' ? '_delta_dir': '_delta_file';
 	my $copyfrom = $ccinfo->{'.copyfrom'};
-	my ($fromroot) = $copyfrom ? $arg{xdroot}->get_revision_root($target->path_anchor, $ccinfo->{'.copyfrom_rev'}) : undef;
+	my ($fromroot) = $copyfrom ? $base_root->get_revision_root($target->path_anchor, $ccinfo->{'.copyfrom_rev'}) : undef;
 	# XXX: actually we want to rerun the delta with base being the copy root,
 	# figure out why it needs to be in xdroot to work (see mirror/sync-crazy-replace.t)
 	$delta .= '2';
@@ -400,7 +399,7 @@
 				     base_root_is_xd => 0 });
 	}
 	else {
-	    $self->$delta($base_root, $base_path eq '/' ? "/$entry" : "$base_path/$entry", $entry_target, $editor,
+	    $self->$delta($base_root, $entry_target->path, $entry_target, $editor,
 				   { %arg, %newpaths,
 				     add => 1,
 				     baton => $baton,
@@ -460,7 +459,7 @@
             if $ctx->{kind}
             && $ctx->{base_kind}
             && $self->can('_prop_changed')->(
-            $base_root, $base_path, $ctx->{ xdroot },
+            $base_root, $base_path, $target->root,
             $target->path_anchor
             );
     }

Modified: branches/delta-refactor/lib/SVK/DeltaOld.pm
==============================================================================
--- branches/delta-refactor/lib/SVK/DeltaOld.pm	(original)
+++ branches/delta-refactor/lib/SVK/DeltaOld.pm	Mon Nov  3 06:10:09 2008
@@ -233,6 +233,8 @@
 sub _prop_changed {
     my ($root1, $path1, $root2, $path2) = @_;
     ($root1, $root2) = map {$_->isa ('SVK::Root') ? $_->root : $_} ($root1, $root2);
+    # XXX: do better check for this case, or make this a root helper method.
+    return 1 if $root1->isa('SVK::Root::Checkout') || $root2->isa('SVK::Root::Checkout');
     return SVN::Fs::props_changed ($root1, $path1, $root2, $path2);
 }
 
@@ -620,7 +622,8 @@
     my ($self, $target, $editor, $opt) = @_;
 
     my $source = $target->source;
-    my $base_root = $target->create_xd_root;
+    my $xdroot = $target->create_xd_root;
+    my $base_root = $opt->{base_root} || $xdroot;
     my $base_kind = $base_root->check_path($source->path_anchor);
 
     die "checkout_delta called with non-dir node"
@@ -628,8 +631,8 @@
 
     my %arg = ( 
                 base_root => $base_root,
-                xdroot => $base_root,
-                base_root_is_xd => 1,
+                xdroot => $opt->{xdroot} || $base_root,
+                base_root_is_xd => $opt->{xdroot} ? 0 : 1,
                 encoder => get_encoder,
 
                 copath => $target->copath,


More information about the svk-commit mailing list