Verified Commit 4099fa15 authored by Florian Pritz's avatar Florian Pritz
Browse files

dbscripts: Update svnlog to 1.15



This fixes an issue with utf8 encoding in From headers that starts
appearing with perl 5.24. Dont't ask me why it worked before.
Signed-off-by: Florian Pritz's avatarFlorian Pritz <bluewind@xinu.at>
parent d381b2e8
#!/usr/bin/perl -w
our $ID = q($Id: svnlog,v 1.14 2007-01-05 18:42:09 eagle Exp $ );
our $ID = q($Id: svnlog,v 1.15 2009-02-28 23:02:39 eagle Exp $ );
#
# svnlog -- Mail Subversion commit notifications.
#
# Written by Russ Allbery <rra@stanford.edu>
# Copyright 2005, 2006, 2007 Board of Trustees, Leland Stanford Jr. University
#
# Copyright 2005, 2006, 2007, 2009
# Board of Trustees, Leland Stanford Jr. University
# Based on cvslog, copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004
# Board of Trustees, Leland Stanford Jr. University
#
......@@ -21,10 +21,10 @@ require 5.008;
use strict;
use Date::Parse qw(str2time);
use Encode qw(decode encode FB_CROAK);
use Getopt::Long qw(GetOptions);
use IPC::Open2 qw(open2);
use POSIX qw(strftime);
use Encode qw(encode decode);
# The path to the repository, set later.
our $REPOSITORY;
......@@ -205,16 +205,23 @@ sub parse_debbugs {
# Determine the From header of the message from the user provided. Right now,
# this is dead simple, but I'm guessing it will get more complex later as I
# find more ways of getting this information.
#
# We currently assume that all names containing non-ASCII characters are
# encoded in UTF-8. If they're not, we send them verbatim in the mail
# message.
sub build_from {
my ($data) = @_;
my $user = $$data{author};
my $name = (getpwnam $user)[6] || '';
$name =~ s/,.*//;
my $utf8 = eval { decode ('utf-8', $name, FB_CROAK) };
unless ($@) {
$name = encode ('MIME-Q', $utf8);
}
if ($name =~ /[^\w ]/) {
$name = '"' . $name . '"';
}
$name = decode('utf-8', $name);
return "From: " . encode('MIME-Q', ($name ? "$name <$user>" : $user)). "\n";
return "From: " . ($name ? "$name <$user>" : $user) . "\n";
}
# Takes the data hash, a prefix to add to the subject header, and a flag
......@@ -318,7 +325,7 @@ sub build_diff {
for (@$diff) {
$length += length ($_);
}
if ($length > 40 * 1024) {
if ($length > 200 * 1024) {
my $old = $rev - 1;
return "The diff is longer than the limit of 200KB.\n"
. "Use svn diff -r $old:$rev to see the changes.\n";
......@@ -712,11 +719,16 @@ will depend a great deal on your Subversion configuration).
Sets the From header of the mail generated by B<svnlog> to I<from>. This
must be syntactically valid as the contents of an RFC 2822 From header (a
simple address of course qualifies). If this option is not given, the From
header will be set to the user who made the commit, with their full name
added if they're found in the local password file or equivalent. (Normally,
the local mail system will then append a local domain to form an e-mail
address.)
simple address of course qualifies). If this option is not given, the
From header will be set to the user who made the commit, with their full
name added if they're found in the local password file or equivalent.
(Normally, the local mail system will then append a local domain to form
an e-mail address.)
I<from> should be specified in UTF-8. If it is, it will be encoded using
RFC 2047 encoding if needed. If it is encoded in some other character
set, B<svnlog> will try to use it in the mail message without modification
or encoding, which may produce surprising results.
=item B<-H> I<header>, B<--header>=I<header>
......@@ -1007,6 +1019,15 @@ configuration parameters are not given.
=back
=head1 CAVEATS
B<svnlog> assumes that the full name in the local password file or
equivalent is encoded in UTF-8. If it appears to be valid UTF-8, it will
be used as UTF-8, which may mangle the name if it were actually in a
different encoding. If it's not valid UTF-8, B<svnlog> will use the full
name without modification in the mail message, which may result in a
syntactically invalid mail message and unexpected results.
=head1 BUGS
B<svnlog>, when given the B<-l> option, can generate syntactically invalid
......@@ -1048,7 +1069,7 @@ debcommit(1), diffstat(1), svnlook(1).
The Subversion manual at L<http://svnbook.red-bean.com/>.
diffstat is at L<http://dickey.his.com/diffstat/diffstat.html>.
diffstat is at L<http://invisible-island.net/diffstat/>.
Current versions of this program are available from its web site at
L<http://www.eyrie.org/~eagle/software/svnlog/>.
......@@ -1059,7 +1080,8 @@ Russ Allbery <rra@stanford.edu>.
=head1 COPYRIGHT AND LICENSE
Copyright 2005, 2006, 2007 Board of Trustees, Leland Stanford Jr. University.
Copyright 2005, 2006, 2007, 2009 Board of Trustees, Leland Stanford Jr.
University.
Based on cvslog, copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Board of
Trustees, Leland Stanford Jr. University.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment