[svk-commit] r3133 - in branches/delta-refactor/lib/SVK: Path Root
nobody at bestpractical.com
nobody at bestpractical.com
Tue Nov 4 13:02:42 EST 2008
Author: clkao
Date: Tue Nov 4 13:02:41 2008
New Revision: 3133
Modified:
branches/delta-refactor/lib/SVK/Delta.pm
branches/delta-refactor/lib/SVK/Path/Checkout.pm
branches/delta-refactor/lib/SVK/Root/Checkout.pm
Log:
- eliminate one use of $type in _delta_entry.
- make root::checkout respect copies made on the checkout.
Modified: branches/delta-refactor/lib/SVK/Delta.pm
==============================================================================
--- branches/delta-refactor/lib/SVK/Delta.pm (original)
+++ branches/delta-refactor/lib/SVK/Delta.pm Tue Nov 4 13:02:41 2008
@@ -61,7 +61,7 @@
use base 'SVK::DeltaOld';
__PACKAGE__->mk_accessors(qw(cb_conflict cb_ignored cb_unchanged cb_resolve_rev cb_unknown
- _compat_xdroot
+ _compat_xdroot cb_unknown_node_type
));
*_node_type = *SVK::DeltaOld::_node_type;
@@ -144,7 +144,7 @@
$self->cb_unchanged(delete $arg{cb_unchanged});
$self->cb_ignored(delete $arg{cb_ignored});
$self->cb_unknown(delete $arg{cb_unknown});
-
+ $self->cb_unknown_node_type(delete $arg{cb_unknown_node_type});
$self->cb_resolve_rev($arg{cb_resolve_rev});
$arg{cb_copyfrom} ||= $arg{expand_copy} ? sub { (undef, -1) }
@@ -302,13 +302,15 @@
my ($type, $st) = _node_type($entry_target->copath) or return;
# XXX: get this from new_entry hash directly once it's passed in
my $pkind = $entry_target->root->check_path($entry_target->path_anchor);
- $pkind = $newpaths{base_kind} if !$pkind || $pkind == $SVN::Node::unknown;
+ $pkind = $newpaths{base_kind} if $newpaths{base_kind} && (!$pkind || $pkind == $SVN::Node::unknown);
+
+ if ($pkind == $SVN::Node::unknown && $self->cb_unknown_node_type) {
+ $pkind = $self->cb_unknown_node_type->($editor, $newpaths{entry}, $arg{baton});
+ return if $pkind == $SVN::Node::unknown;
+ }
my $delta = $pkind == $SVN::Node::dir ? '_delta_dir2'
- : $pkind == $SVN::Node::file ? '_delta_file2'
- # XXX: this is for auto_add, caller should supply fallback handler
- : $type eq 'file' ? '_delta_file2'
- : '_delta_dir2';
+ : '_delta_file2';
my $obs = $type ? ($newpaths{base_kind} == $SVN::Node::dir xor $pkind == $SVN::Node::dir) : 0;
$newpaths{add} ||= ($obs && $arg{obstruct_as_replace});
Modified: branches/delta-refactor/lib/SVK/Path/Checkout.pm
==============================================================================
--- branches/delta-refactor/lib/SVK/Path/Checkout.pm (original)
+++ branches/delta-refactor/lib/SVK/Path/Checkout.pm Tue Nov 4 13:02:41 2008
@@ -393,6 +393,14 @@
sub run_delta {
my ( $self, $editor, $opt ) = @_;
require SVK::Delta;
+ $opt->{cb_unknown_node_type} = sub {
+ my ( $editor, $path ) = @_;
+ $path = $self->copath($path);
+ lstat $path;
+ return $SVN::Node::none unless -e _;
+ return -d _ ? $SVN::Node::dir : $SVN::Node::file;
+ };
+
my $delta = SVK::Delta->new( { xd => $self->xd, checkout => $self->xd->{checkout} } );
$ENV{_USE_OLD_DELTA}
? $delta->checkout_delta1( $self, $editor, $opt )
Modified: branches/delta-refactor/lib/SVK/Root/Checkout.pm
==============================================================================
--- branches/delta-refactor/lib/SVK/Root/Checkout.pm (original)
+++ branches/delta-refactor/lib/SVK/Root/Checkout.pm Tue Nov 4 13:02:41 2008
@@ -107,7 +107,7 @@
sub node_created_rev {
my ($self, $path, $pool) = @_;
- my ($copath, $root) = $self->_get_copath($path, $pool);
+ my ($copath, $root) = $self->_get_copath($path, $pool, 'nocp');
# ({ kind => $self->path->xd->{checkout}->get($copath)->{'.schedule'} ?
# XXX: fails on really unknown?
return $root->check_path($path, $pool) ? $root->node_created_rev($path, $pool) : undef;
@@ -126,7 +126,7 @@
sub copied_from {
my ($self, $path, $pool) = @_;
- my ($copath, $root) = $self->_get_copath($path, $pool);
+ my ($copath, $root) = $self->_get_copath($path, $pool, 'nocp');
my $entry = $self->path->xd->{checkout}->get($copath, 1);
my $kind = $entry->{'.schedule'};
@@ -137,7 +137,7 @@
sub node_history {
my ($self, $path, $pool) = @_;
- my ($copath, $root) = $self->_get_copath($path, $pool);
+ my ($copath, $root) = $self->_get_copath($path, $pool, 'nocp');
my $entry = $self->path->xd->{checkout}->get($copath, 1);
my $kind = $entry->{'.schedule'} || '';
@@ -200,15 +200,22 @@
}
sub _get_copath {
- my ($self, $path, $pool) = @_;
+ my ($self, $path, $pool, $nocp) = @_;
# XXX: copath shouldn't be copath_anchor!
my $copath = $self->path->copath; $copath = "$copath";
from_native($copath);
$copath = abs2rel($path, $self->path->path_anchor => $copath);
to_native($copath);
my $root;
+ my $entry = $self->path->xd->{checkout}->get($copath, 1);
($root, $_[1]) = $self->path->source->root->get_revision_root
- ($path, $self->path->xd->{checkout}->get($copath, 1)->{revision}, $pool);
+ ($path, $entry->{revision}, $pool);
+
+ if (!$nocp &&
+ (my ($source_path, $source_root) = $self->path->xd->_copy_source($entry, $copath, $root))) {
+ ($root, $_[1]) = ($source_root, $source_path);
+ }
+
return ($copath, $root);
}
More information about the svk-commit
mailing list