--- trunk/svndump-move.pl 2007/08/03 17:52:21 47 +++ trunk/svndump-move.pl 2007/08/03 17:57:25 48 @@ -2,7 +2,7 @@ use strict; use warnings; use SVN::Dump; -use Shell qw/svnadmin cp find svn/; +use Shell qw/svnadmin cp find svn rm/; use Cwd qw/abs_path/; my $base = shift @ARGV; @@ -36,25 +36,30 @@ if ( ! -e $tl ) { cp( $fl, $tl ); die "created $tl\nplease edit it to reflect new layout\n"; -} elsif ( ! -e $to ) { - svnadmin('create', $to); - open(my $fh_in, '-|', "svnadmin dump $from") || die "can't dump $from: $!"; - open(my $fh_out, '|-', "svnadmin load $to") || die "can't load $to: $!"; - - 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"; +} + +if ( -e $to ) { + #die "$to allready exists! remove it to re-create repository\n"; + rm('-Rf',$to); +} - print $fh_out $rec->as_string(); +svnadmin('create', $to); +open(my $fh_in, '-|', "svnadmin dump $from") || die "can't dump $from: $!"; +open(my $fh_out, '|-', "svnadmin load $to") || die "can't load $to: $!"; + +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 ); } -} else { - die "$to allready exists! remove it to re-create repository\n"; + + my $path = $rec->get_header('Node-path'); + warn "##> $path\n" if $path; + + print $fh_out $rec->as_string(); }