SVN-Mirror

 view release on metacpan or  search on metacpan

bin/svm  view on Meta::CPAN

#!/usr/bin/perl -w
use strict;
use SVN::Core '0.32';
use SVN::Mirror;

=head1 NAME

svm - command line interface for remote Subversion repository mirroring

=head1 SYNOPSIS

    # the svn repository for svm to use
    % setenv SVMREPOS ~/svm

    # set the path mirror/svn to mirror official subversion trunk
    % svm init mirror/svn http://svn.collab.net/repos/svn/trunk

    # run the actual mirroring
    # flatten the changesets between revision 1 thru 6000
    % svm sync mirror/svn 6000

    # merge back changes in local branch
    % svn cp file://$SVMREPOS/mirror/svn file://$SVMREPOS/svn-local
    # make some changes and then merge back to source repository
    % svm mergeback mirror/svn svn-local

=head1 DESCRIPTION

F<svm> mirrors remote repository accissible via L<SVN::Ra> interface
to a local repository.

=head1 COMMANDS

=over

=item init B<path> B<url>

Initialize the B<path> in svm repository to mirror from B<url>.

=item sync B<path> B<[sync_to]>

Invoke the synchronization of B<path> in svm repository according the
how it is initialized.

=back

=cut

my $repospath = $ENV{SVMREPOS} || $ENV{HOME}.'/svn/svm';
my $auth = SVN::Core::auth_open ([SVN::Client::get_simple_provider,
				  SVN::Client::get_ssl_server_trust_file_provider,
				  SVN::Client::get_username_provider]);

sub help {
    require Pod::Text;
    my $parser = Pod::Text->new (sentence => 0, width => 78);
    $parser->parse_from_file ($0, '-' );
}

sub init {
    die "$0 init <path> <source>" unless $#_ == 1;
    my ($path, $source) = @_;
    my $m = SVN::Mirror->new(target_path => $path, target => $repospath,
			     auth => $auth,
			     source => $source, target_create => 1);
    $m->init;
}

sub ls {
    my $m = SVN::Mirror->new(target => $repospath);

    $m->list;
}



( run in 1.744 second using v1.01-cache-2.11-cpan-6aa56a78535 )