File: svndump_replace_author.pl

package info (click to toggle)
libsvn-dump-perl 0.08-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 416 kB
  • sloc: perl: 682; makefile: 7
file content (21 lines) | stat: -rw-r--r-- 519 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl
use strict;
use warnings;
use SVN::Dump;

die "svndump_replace_author.pl <from> <to> [file]" if @ARGV < 2;

my ( $from, $to ) = splice( @ARGV, 0, 2 );

my $dump = SVN::Dump->new( { file => @ARGV ? $ARGV[0] : '-' } );

while ( my $rec = $dump->next_record() ) {
    if (   $rec->type() eq 'revision'
        && $rec->get_header( 'Revision-number' ) != 0
        && $rec->get_property('svn:author') eq $from )
    {
        $rec->set_property( 'svn:author' => $to );
    }
    print $rec->as_string();
}