[svk-commit] r3116 - branches/delta-refactor/lib/SVK
nobody at bestpractical.com
nobody at bestpractical.com
Mon Nov 3 06:34:19 EST 2008
Author: clkao
Date: Mon Nov 3 06:34:17 2008
New Revision: 3116
Modified:
branches/delta-refactor/lib/SVK/Delta.pm
branches/delta-refactor/lib/SVK/DeltaOld.pm
branches/delta-refactor/lib/SVK/XD.pm
Log:
- make do_add use run_delta api.
- retire old checkout_delta api.
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:34:17 2008
@@ -60,10 +60,58 @@
use base 'SVK::DeltaOld';
-__PACKAGE__->mk_accessors(qw(cb_conflict cb_ignored cb_unchanged cb_resolve_rev));
+__PACKAGE__->mk_accessors(qw(cb_conflict cb_ignored cb_unchanged cb_resolve_rev cb_unknown));
*_node_type = *SVK::DeltaOld::_node_type;
+=head1 NAME
+
+SVK::Delta -
+
+=head1 SYNOPSIS
+
+
+
+=head1 DESCRIPTION
+
+Options:
+
+=over
+
+=item delete_verbose
+
+Generate delete_entry calls for sub-entries within deleted entry.
+
+=item absent_verbose
+
+Generate absent_* calls for sub-entries within absent entry.
+
+=item unknown_verbose
+
+generate cb_unknown calls for sub-entries within absent entry.
+
+=item absent_ignore
+
+Don't generate absent_* calls.
+
+=item expand_copy
+
+Mimic the behavior like SVN::Repos::dir_delta, lose copy information
+and treat all copied descendents as added too.
+
+=item cb_ignored
+
+Called for ignored items if defined.
+
+=item cb_unchanged
+
+Called for unchanged files if defined.
+
+=back
+
+
+=cut
+
sub run {
my ($self, $t1, $t2) = @_;
}
@@ -90,6 +138,7 @@
$self->cb_conflict(delete $arg{cb_conflict});
$self->cb_unchanged(delete $arg{cb_unchanged});
$self->cb_ignored(delete $arg{cb_ignored});
+ $self->cb_unknown(delete $arg{cb_unknown});
$self->cb_resolve_rev($arg{cb_resolve_rev});
@@ -150,6 +199,7 @@
cb_conflict => $self->cb_conflict,
cb_unchanged => $self->cb_unchanged,
cb_ignored => $self->cb_ignored,
+ cb_unknown => $self->cb_unknown,
# compat for now
editor => $editor,
@@ -366,9 +416,9 @@
if $self->cb_conflict;
}
unless ($add || $ccinfo->{'.conflict'}) {
- if ($arg{cb_unknown}) {
- $arg{cb_unknown}->($editor, $newpaths{entry}, $arg{baton});
- $self->_unknown_verbose(%arg, %newpaths,
+ if ($self->cb_unknown) {
+ $self->cb_unknown->($editor, $newpaths{entry}, $arg{baton});
+ $self->_unknown_verbose(%arg, %newpaths, %compatarg,
copath => $entry_target->copath,
path => $target->path_anchor,
base_path => $base_path eq '/' ? "/$entry" : "$base_path/$entry")
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:34:17 2008
@@ -577,41 +577,6 @@
$_[0]->{checkout}->get ($_[1])->{revision};
}
-sub checkout_delta {
- my ($xd, %arg) = @_;
- my $self = __PACKAGE__->new(\%arg);
- $self->xd($xd);
- $self->checkout($xd->{checkout});
- $arg{base_root} ||= $arg{xdroot}; # xdroot is the
- $arg{base_path} ||= $arg{path}; # path is -> string name of file in repo
- $arg{encoder} = get_encoder;
- Carp::cluck unless defined $arg{base_path};
- my $kind = $arg{base_kind} = $arg{base_root}->check_path ($arg{base_path});
- $arg{base_root_is_xd} = $arg{base_root}->same_root($arg{xdroot});
- $arg{kind} = $arg{base_root_is_xd} ? $kind : $arg{xdroot}->check_path ($arg{path});
- die "checkout_delta called with non-dir node"
- unless $kind == $SVN::Node::dir;
- my ($copath, $repospath) = @arg{qw/copath repospath/};
- $arg{editor}{_debug}++
- if $arg{debug};
- $arg{editor} = SVK::Editor::Delay->new ($arg{editor})
- unless $arg{nodelay};
-
- # 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]) };
- local $SIG{INT} = sub {
- $arg{editor}->abort_edit;
- die loc("Interrupted.\n");
- };
-
- 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 ();
-}
-
sub get_entry {
my ($self, $copath, $dont_clone) = @_;
my $entry = $self->checkout->get($copath, $dont_clone);
Modified: branches/delta-refactor/lib/SVK/XD.pm
==============================================================================
--- branches/delta-refactor/lib/SVK/XD.pm (original)
+++ branches/delta-refactor/lib/SVK/XD.pm Mon Nov 3 06:34:17 2008
@@ -813,25 +813,12 @@
sub do_add {
my ($self, $target, %arg) = @_;
-# $target->run_delta(
-# SVK::Editor::Status->new(
-# notify => SVK::Notify->new(
-# cb_flush => sub {
-# my ( $path, $status ) = @_;
-# to_native( $path, 'path' );
-# my $copath = $target->copath($path);
-# my $report = $target->report->subdir($path);
-
- $self->checkout_delta(
- $target->for_checkout_delta,
- %arg,
- xdroot => $target->create_xd_root,
- delete_verbose => 1,
- editor => SVK::Editor::Status->new(
+ $target->run_delta(
+ SVK::Editor::Status->new(
notify => SVK::Notify->new(
cb_flush => sub {
- my ($path, $status) = @_;
- to_native($path, 'path');
+ my ( $path, $status ) = @_;
+ to_native( $path, 'path' );
my $copath = $target->copath($path);
my $report = $target->report ? $target->report->subdir($path) : $path;
@@ -846,15 +833,20 @@
},
),
),
- cb_unknown => sub {
- my ($editor, $path) = @_;
- to_native($path, 'path');
- my $copath = $target->copath($path);
- my $report = $target->_to_pclass($target->report)->subdir($path);
- lstat ($copath);
- $self->_do_add('A', $copath, $report, !-d _, %arg);
- },
- );
+ {
+ %arg,
+ delete_verbose => 1,
+ cb_unknown => sub {
+ my ($editor, $path) = @_;
+ to_native($path, 'path');
+ my $copath = $target->copath($path);
+ my $report = $target->_to_pclass($target->report)->subdir($path);
+ lstat ($copath);
+ $self->_do_add('A', $copath, $report, !-d _, %arg);
+ },
+ use_old_delta => 1,
+ }
+ );
return;
}
@@ -979,48 +971,6 @@
$arg{pool});
}
-=item checkout_delta
-
-Generate C<SVN::Delta::Editor> calls to represent the local changes
-made to the checked out revision.
-
-Options:
-
-=over
-
-=item delete_verbose
-
-Generate delete_entry calls for sub-entries within deleted entry.
-
-=item absent_verbose
-
-Generate absent_* calls for sub-entries within absent entry.
-
-=item unknown_verbose
-
-generate cb_unknown calls for sub-entries within absent entry.
-
-=item absent_ignore
-
-Don't generate absent_* calls.
-
-=item expand_copy
-
-Mimic the behavior like SVN::Repos::dir_delta, lose copy information
-and treat all copied descendents as added too.
-
-=item cb_ignored
-
-Called for ignored items if defined.
-
-=item cb_unchanged
-
-Called for unchanged files if defined.
-
-=back
-
-=cut
-
my %ignore_cache;
sub ignore {
@@ -1044,15 +994,6 @@
return join('|', map {$ignore_cache{$_} ||= compile_apr_fnmatch($_)} (@ignore));
}
-require SVK::DeltaOld;
-# Emulates APR's apr_fnmatch function with flags=0, which is what
-# Subversion uses. Converts a string in fnmatch format to a Perl regexp.
-# Code is based on Barrie Slaymaker's Regexp::Shellish.
-
-sub checkout_delta {
- goto \&SVK::DeltaOld::checkout_delta;
-}
-
=item get_entry($copath)
Returns the L<Data::Hierarchy> entry and the schedule of the entry.
More information about the svk-commit
mailing list