2 |
use strict; |
use strict; |
3 |
use warnings; |
use warnings; |
4 |
use SVN::Dump; |
use SVN::Dump; |
5 |
use Shell qw/svnadmin cp find svn/; |
use Shell qw/svnadmin cp find svn rm/; |
6 |
use Cwd qw/abs_path/; |
use Cwd qw/abs_path/; |
7 |
|
|
8 |
my $base = shift @ARGV; |
my $base = shift @ARGV; |
36 |
if ( ! -e $tl ) { |
if ( ! -e $tl ) { |
37 |
cp( $fl, $tl ); |
cp( $fl, $tl ); |
38 |
die "created $tl\nplease edit it to reflect new layout\n"; |
die "created $tl\nplease edit it to reflect new layout\n"; |
39 |
} elsif ( ! -e $to ) { |
} |
40 |
svnadmin('create', $to); |
|
41 |
open(my $fh_in, '-|', "svnadmin dump $from") || die "can't dump $from: $!"; |
if ( -e $to ) { |
42 |
open(my $fh_out, '|-', "svnadmin load $to") || die "can't load $to: $!"; |
#die "$to allready exists! remove it to re-create repository\n"; |
43 |
|
rm('-Rf',$to); |
44 |
my $dump = SVN::Dump->new( { fh => $fh_in } ); |
} |
|
|
|
|
warn "## $from -> $to\n"; |
|
|
|
|
|
while ( my $rec = $dump->next_record() ) { |
|
|
my $type = $rec->type(); |
|
|
if ( $type eq 'revision' && $rec->get_header( 'Revision-number' ) != 0 ) { |
|
|
my $to = 'dpavlin@rot13.org'; |
|
|
$rec->set_property( 'svn:author' => $to ); |
|
|
} |
|
|
warn "##> ", $rec->get_header('Node-path'), "\n"; |
|
45 |
|
|
46 |
print $fh_out $rec->as_string(); |
svnadmin('create', $to); |
47 |
|
open(my $fh_in, '-|', "svnadmin dump $from") || die "can't dump $from: $!"; |
48 |
|
open(my $fh_out, '|-', "svnadmin load $to") || die "can't load $to: $!"; |
49 |
|
|
50 |
|
my $dump = SVN::Dump->new( { fh => $fh_in } ); |
51 |
|
|
52 |
|
warn "## $from -> $to\n"; |
53 |
|
|
54 |
|
while ( my $rec = $dump->next_record() ) { |
55 |
|
my $type = $rec->type(); |
56 |
|
if ( $type eq 'revision' && $rec->get_header( 'Revision-number' ) != 0 ) { |
57 |
|
my $to = 'dpavlin@rot13.org'; |
58 |
|
$rec->set_property( 'svn:author' => $to ); |
59 |
} |
} |
60 |
} else { |
|
61 |
die "$to allready exists! remove it to re-create repository\n"; |
my $path = $rec->get_header('Node-path'); |
62 |
|
warn "##> $path\n" if $path; |
63 |
|
|
64 |
|
print $fh_out $rec->as_string(); |
65 |
} |
} |