SVK
view release on metacpan or search on metacpan
lib/SVK/Mirror/Backend/SVNSync.pm view on Meta::CPAN
# by submitting them to Best Practical Solutions, LLC.)
#
# By intentionally submitting any modifications, corrections or
# derivatives to this work, or any other work intended for use with SVK,
# to Best Practical Solutions, LLC, you confirm that you are the
# copyright holder for those contributions and you grant Best Practical
# Solutions, LLC a nonexclusive, worldwide, irrevocable, royalty-free,
# perpetual, license to use, copy, create derivative works based on
# those contributions, and sublicense and distribute those contributions
# and any derivatives thereof.
#
# END BPS TAGGED BLOCK }}}
package SVK::Mirror::Backend::SVNSync;
use strict;
use base 'SVK::Mirror::Backend::SVNRa';
use SVK::I18N;
sub _do_load_fromrev {
my $self = shift;
return $self->mirror->repos->fs->youngest_rev;
}
sub load {
my ( $class, $mirror ) = @_;
my $self = $class->new( { mirror => $mirror } );
my $fs = $mirror->depot->repos->fs;
$mirror->url( $fs->revision_prop( 0, 'svn:svnsync:from-url' ) );
$mirror->server_uuid( $fs->revision_prop( 0, 'svn:svnsync:from-uuid' ) );
$mirror->source_uuid( $fs->revision_prop( 0, 'svn:svnsync:from-uuid' ) );
die loc("%1 is not a mirrored path.\n", "/".$self->mirror->depot->depotname."/")
unless $mirror->url;
$self->source_root( $mirror->url );
$self->source_path('');
$self->refresh;
return $self;
}
sub _init_state {
my ( $self, $txn, $editor ) = @_;
die loc("Requires newer svn for replay support when mirroring to /.\n")
unless $self->has_replay;
my $mirror = $self->mirror;
die loc( "Must replicate whole repository at %1.\n", $mirror->url )
if $self->source_path;
my $fs = $mirror->depot->repos->fs;
if ( my $from = $fs->revision_prop( 0, 'svn:svnsync:from-url' ) ) {
die loc( "%1 is already a mirror of %2.\n",
"/" . $mirror->depot->depotname . "/", $from );
}
$fs->change_rev_prop( 0, 'svn:svnsync:from-url', $mirror->url );
$fs->change_rev_prop( 0, 'svn:svnsync:from-uuid', $mirror->server_uuid );
# $fs->change_rev_prop(0, 'svn:svnsync:last-merged-rev', 0);
return $self;
}
sub _do_relocate {
my ($self) = @_;
$self->mirror->depot->repos->fs->change_rev_prop( 0, 'svn:svnsync:from-url', $self->mirror->url );
}
sub find_rev_from_changeset { $_[1] }
sub find_changeset { $_[1] }
sub _revmap_prop { }
sub _get_sync_editor {
my ($self, $editor, $changeset) = @_;
return SVK::Editor::CopyHandler->new(
_editor => $editor,
cb_copy => sub {
my ( $editor, $path, $rev ) = @_;
return ( $path, $rev ) if $rev == -1;
$path =~ s{^\Q/}{};
return ( $path, $rev );
}
)
}
sub _after_replay {
my ($self, $ra, $editor) = @_;
$editor->close_edit;
}
sub _relayed { }
1;
( run in 0.523 second using v1.01-cache-2.11-cpan-5511b514fd6 )