aboutsummaryrefslogtreecommitdiffstats
path: root/check_trans.pl
diff options
context:
space:
mode:
authorBas Zoetekouw <bas>2008-09-29 23:26:01 +0000
committerBas Zoetekouw <bas>2008-09-29 23:26:01 +0000
commit008ef39d627e5c5e8308f188bbdfac1bd544d004 (patch)
treee7874248e685a132338078397fe893730ad5b980 /check_trans.pl
parent4d93c5f6de81d0565035e163898088681cf909be (diff)
Fix mailing of check_trans updates:
- actually parse the argument to -m - fix the format of log output (still had svn revisions) - fix encoding of mails - fix overly verbose errors CVS version numbers check_trans.pl: 1.65 -> 1.66
Diffstat (limited to 'check_trans.pl')
-rwxr-xr-xcheck_trans.pl37
1 files changed, 22 insertions, 15 deletions
diff --git a/check_trans.pl b/check_trans.pl
index cdab7b638d9..8e96437df73 100755
--- a/check_trans.pl
+++ b/check_trans.pl
@@ -327,16 +327,21 @@ sub verbose;
if ( $status != ST_MISSING )
{
$maxdelta ||= $translators{maxdelta}{maxdelta} || 5;
- my $delta = vcs_count_changes( $file_orig, $rev_transl, 'HEAD' );
-
- push @{ $emails_to_send{'maxdelta'} }, {
- 'file' => $file,
- 'status' => $status,
- 'info' => $str,
- 'delta' => $delta,
- 'last_trans_rev' => $rev_transl,
+
+ my $delta = undef;
+ if ( -e $file_orig )
+ {
+ $delta = vcs_count_changes( $file_orig, $rev_transl, 'HEAD' );
+
+ push @{ $emails_to_send{'maxdelta'} }, {
+ 'file' => $file,
+ 'status' => $status,
+ 'info' => $str,
+ 'delta' => $delta,
+ 'last_trans_rev' => $rev_transl,
+ }
+ if ( $delta >= $maxdelta );
}
- if ( $delta >= $maxdelta );
}
}
@@ -439,10 +444,12 @@ sub send_email
}
# and attach the body to the mail
- $msg->attach(
- 'Type' => 'TEXT',
+ my $part = MIME::Lite->new(
+ 'Type' => 'text/plain',
'Data' => $body,
);
+ $part->attr( 'content-type.charset' => 'utf-8' );
+ $msg->attach( $part );
# attach part about NeedToUpdate files
my $text = '';
@@ -548,7 +555,7 @@ sub send_email
my $rev = $file->{'last_trans_rev'};
my $log = get_log( $filename, $rev, 'HEAD' );
my $part = MIME::Lite->new(
- 'Type' => 'TEXT',
+ 'Type' => 'TEXT',
'Filename' => "$filename.log",
'Data' => $log,
'Encoding' => 'quoted-printable',
@@ -645,7 +652,7 @@ sub get_log
{
chomp $l->{'message'};
- $str .= sprintf( "r%d | %s | %s\n",
+ $str .= sprintf( "%s | %s | %s\n",
$l->{'rev'}, $l->{'author'}, scalar localtime $l->{'date'} );
$str .= "\n";
$str .= $l->{'message'} . "\n";
@@ -744,7 +751,7 @@ sub parse_cmdargs
$OPT{s} = '';
# parse options
- if ( not getopts( 'adghmn:p:qs:TvV', \%OPT ) )
+ if ( not getopts( 'adghm:n:p:qs:TvV', \%OPT ) )
{
show_help();
exit -1;
@@ -773,7 +780,7 @@ sub parse_cmdargs
if ( $OPT{'m'} and $OPT{'n'} !~ m{^[123]$} )
{
- die "Invalid priority. Please set -n value to 1, 2 or 3.\n"
+ die "Invalid priority `$OPT{n}'. Please set -n value to 1, 2 or 3.\n"
."(assuming you know what you're doing)\n";
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy