Brought in file from ~ backup files, as it was on 2011-01-21

This commit is contained in:
Bradley M. Kuhn 2011-01-21 05:59:12 -08:00
parent 6352d93107
commit e914bcd6ac

View file

@ -6,14 +6,16 @@ use warnings;
use Mail::Header; use Mail::Header;
use File::Copy; use File::Copy;
if (@ARGV < 2) { my $RM_CMD = "/bin/rm";
print STDERR "usage: $0 <TYPE> <SOURCE_MAILDIR_FOLDER_PATH> [<MALDIRS_LOOK_FOR_DUPS_IN> ...]\n";
if (@ARGV < 1) {
print STDERR "usage: $0 <SOURCE_MAILDIR_FOLDER_PATH> [<MALDIRS_LOOK_FOR_DUPS_IN> ...]\n";
exit 1; exit 1;
} }
my($TYPE, $MAILDIR_FOLDER) = ($ARGV[0], $ARGV[1]); my($MAILDIR_FOLDER) = $ARGV[0];
my (@dupFolders) = @ARGV[2..$#ARGV]; my (@dupFolders) = @ARGV[1..$#ARGV];
my %msgs; # indexed by Message-Id my %msgs; # indexed by Message-Id
@ -80,17 +82,9 @@ foreach my $dir (@msgDirs) {
# it to %msgs. # it to %msgs.
if (defined $msgs{$id}) { if (defined $msgs{$id}) {
if ($TYPE eq "print") { system("$RM_CMD \"$existing_file\"");
print "$id\n"; die "Unable to unlink file $existing_file: $!"
} elsif ($TYPE eq "svn") { unless $? == 0;
system("svn rm \"$existing_file\"");
die "Unable to unlink file $existing_file: $!"
unless $? == 0;
} else {
print STDERR "Removing $existing_file\n";
die "Unable to unlink $existing_file: $!"
unless unlink($existing_file) == 1;
}
} else { } else {
$msgs{$id} = $fields; $msgs{$id} = $fields;
} }