#!/usr/bin/perl # Copyright (C) 2006 Eric L. Wilhelm use warnings; use strict; use File::Temp qw(tempdir); use File::Which qw(which); use File::Path qw(rmtree); use Getopt::Helpful; our $svk; our $svnadmin; BEGIN { our $svk = which('svk'); $svk or die 'no svk!'; our $svnadmin = which('svnadmin'); $svnadmin or die 'no svnadmin!'; } ($0 eq __FILE__) and exit(main(@ARGV)); sub main { my (@args) = @_; my $src; my $dst; my $hopt = Getopt::Helpful->new( usage => "CALLER [options]", '+help', ); $hopt->Get_from(\@args); $src ||= shift(@args); $src or $hopt->usage('src arg is required'); $dst ||= shift(@args); $dst or $hopt->usage('dst arg is required'); # note: might want to be able to have a persistent dir here my $tmpdir = tempdir('svn_rcopy-' . 'X'x8, TMPDIR=>1); $ENV{SVKROOT} = $tmpdir; # XXX use IPC::Run to suppress all of this noise system($svnadmin, qw(create --fs-type fsfs), "$tmpdir/local"); system($svk, 'depotmap', '-i') and die; my $msrc = '//src'; my $mdst = '//dst'; system($svk, 'mirror', $src, $msrc) and die; system($svk, 'sync', $msrc) and die; system($svk, 'mirror', $dst, $mdst) and die; system($svk, 'sync', $mdst) and die; # XXX this is no fun with -b 1 (when I have to answer a hundred # conflict questions!) system($svk, qw(smerge -I -B --verbatim), $msrc, $mdst) and die; system($svk, 'sync', $mdst) and die; rmtree($tmpdir); 0; } =head1 NAME svn_rcopy - mirror one remote svn repository to another =head1 SYNOPSIS Currently, just a wrapper for svk. =cut =begin maintainers =head1 Subroutine and API details. =cut =end maintainers =cut 1;