[svk-commit] r2381 - in trunk: lib/SVK lib/SVK/Mirror/Backend
t/mirror
nobody at bestpractical.com
nobody at bestpractical.com
Sun Apr 8 04:57:43 EDT 2007
Author: clkao
Date: Sun Apr 8 04:57:42 2007
New Revision: 2381
Modified:
trunk/lib/SVK/Command/Copy.pm
trunk/lib/SVK/Mirror/Backend/SVNRa.pm
trunk/lib/SVK/Mirror/Backend/SVNSync.pm
trunk/lib/SVK/Path.pm
trunk/t/mirror/sync-revhole.t
Log:
Make the SVK::Path editors handle copy translations, rather than
telling checkout_delta to do so via cb_copyfrom.
Modified: trunk/lib/SVK/Command/Copy.pm
==============================================================================
--- trunk/lib/SVK/Command/Copy.pm (original)
+++ trunk/lib/SVK/Command/Copy.pm Sun Apr 8 04:57:42 2007
@@ -162,7 +162,7 @@
if (!$self->{parent} && $dst->{targets} && !$dst->root->check_path ($dst->path_anchor)) {
die loc ("Parent directory %1 doesn't exist, use -p.\n", $dst->report);
}
- my ($path, $rev) = $src->as_url(!$m);
+ my ($path, $rev) = ($src->path, $src->revision);
my $baton = $editor->add_directory (abs2rel ($dst->path, $anchor => undef, '/'), 0, $path, $rev);
$other_call->($baton) if $other_call;
$editor->close_directory($baton);
Modified: trunk/lib/SVK/Mirror/Backend/SVNRa.pm
==============================================================================
--- trunk/lib/SVK/Mirror/Backend/SVNRa.pm (original)
+++ trunk/lib/SVK/Mirror/Backend/SVNRa.pm Sun Apr 8 04:57:42 2007
@@ -511,7 +511,6 @@
sub _get_sync_editor {
my ($self, $editor, $target) = @_;
- $editor = SVK::Editor::MapRev->wrap_without_copy($editor, $target->revision);
$editor = SVK::Editor::CopyHandler->new(
_editor => $editor,
@@ -520,11 +519,8 @@
return ( $path, $rev ) if $rev == -1;
my $source_path = $self->source_path;
$path =~ s/^\Q$self->{source_path}//;
- return $target->as_url(
- 1,
- $self->mirror->path . $path,
- $self->find_rev_from_changeset($rev, 1)
- );
+ return ($self->mirror->path . $path,
+ $self->find_rev_from_changeset($rev, 1) );
}
);
Modified: trunk/lib/SVK/Mirror/Backend/SVNSync.pm
==============================================================================
--- trunk/lib/SVK/Mirror/Backend/SVNSync.pm (original)
+++ trunk/lib/SVK/Mirror/Backend/SVNSync.pm Sun Apr 8 04:57:42 2007
@@ -108,15 +108,13 @@
sub _get_sync_editor {
my ($self, $editor, $target) = @_;
- $editor = SVK::Editor::MapRev->wrap_without_copy($editor, $target->revision);
-
return SVK::Editor::CopyHandler->new(
_editor => $editor,
cb_copy => sub {
my ( $editor, $path, $rev ) = @_;
return ( $path, $rev ) if $rev == -1;
$path =~ s{^\Q/}{};
- return $target->as_url( 1, $path, $rev );
+ return ( $path, $rev );
}
)
}
Modified: trunk/lib/SVK/Path.pm
==============================================================================
--- trunk/lib/SVK/Path.pm (original)
+++ trunk/lib/SVK/Path.pm Sun Apr 8 04:57:42 2007
@@ -253,16 +253,20 @@
($mpath, $arg{message}, $mcallback);
$editor->{_debug}++ if $logger->is_debug();
$editor = SVK::Editor::MapRev->wrap_without_copy($editor, $root_baserev);
+ $editor = SVK::Editor::CopyHandler->new(
+ _editor => $editor,
+ cb_copy => sub {
+ my ( $editor, $path, $rev ) = @_;
+ return ( $path, $rev ) if $rev == -1;
+ return $self->as_url(0, $path, $rev);
+ });
+
# XXX: fix me, need local knowledge about txn as well
return ($editor, $self->inspector,
mirror => $m,
post_handler => \$post_handler,
cb_rev => sub { $root_baserev }, #This is the inspector baserev
- cb_copyfrom =>
- sub { my ($path, $rev) = @_;
- my ($m_path, $m_url) = ($m->path, $m->url);
- $path =~ s|^\Q$m_path\E|$m_url|;
- return ($path, scalar $m->find_remote_rev($rev)); });
+ cb_copyfrom => sub { @_ })
}
warn "has $arg{txn}" if $arg{txn};
@@ -284,13 +288,21 @@
$self->_commit_editor($txn, $callback);
$editor = SVK::Editor::TxnCleanup->new(_editor => [$editor], txn => $txn);
+ $editor = SVK::Editor::CopyHandler->new(
+ _editor => $editor,
+ cb_copy => sub {
+ my ( $editor, $path, $rev ) = @_;
+ return ( $path, $rev ) if $rev == -1;
+ return $self->as_url(1, $path, $rev);
+ });
+
return ($editor, $inspector,
send_fulltext => 1,
post_handler => $post_handler_ref,
txn => $txn,
aborts_txn => $arg{txn} ? 0 : 1,
cb_rev => sub { $root_baserev },
- cb_copyfrom => sub { $self->as_url(1, @_) });
+ cb_copyfrom => sub { @_ });
}
sub get_dynamic_editor {
Modified: trunk/t/mirror/sync-revhole.t
==============================================================================
--- trunk/t/mirror/sync-revhole.t (original)
+++ trunk/t/mirror/sync-revhole.t Sun Apr 8 04:57:42 2007
@@ -40,7 +40,7 @@
$path->get_editor( callback => sub { ok(1, 'committed with api') },
author => 'svktest', message => 'creating copy with revhole');
my $rb = $editor->open_root($path->revision);
- $editor->close_file( $editor->add_file('qu-from-a', $rb, uri($srepospath."/A/Q/qu"), 4), undef);
+ $editor->close_file( $editor->add_file('qu-from-a', $rb, "/A/Q/qu", 4), undef);
$editor->close_directory($rb);
$editor->close_edit;
}
More information about the svk-commit
mailing list