Hello!
This patch allows one to set the complete 'From:' address on hook
scripts. This is very useful in places where there's no way to
simply append the subversion username to some hostname.
* hook-scripts/commit-email.pl
* hook-scripts/propchange-email.pl
Include new -e option which, if set, will override the -h option
and set the email 'From:' to whatever is provided as the option
argument.
Index: commit-email.pl
===================================================================
--- commit-email.pl
+++ commit-email.pl 2002-12-10 11:41:31.000000000 -0200
@@ -90,7 +90,7 @@
while (@ARGV)
{
my $arg = shift @ARGV;
- if (my ($opt) = $arg =~ /^-([hlmrs])/)
+ if (my ($opt) = $arg =~ /^-([helmrs])/)
{
unless (@ARGV)
{
@@ -101,6 +101,7 @@
# This hash matches the command line option to the hash key in
# the project.
my %opt_to_hash_key = (h => 'hostname',
+ e => 'email',
l => 'log_file',
r => 'reply_to',
s => 'subject_prefix');
@@ -363,6 +364,7 @@
my @email_addresses = @{$project->{email_addresses}};
my $userlist = join(' ', @email_addresses);
my $hostname = $project->{hostname};
+ my $email = $project->{email};
my $log_file = $project->{log_file};
my $reply_to = $project->{reply_to};
my $subject_prefix = $project->{subject_prefix};
@@ -382,7 +384,11 @@
}
my $mail_from = $author;
- if ($hostname =~ /\w/)
+ if ($email =~ /\w/)
+ {
+ $mail_from = "$email";
+ }
+ elsif ($hostname =~ /\w/)
{
$mail_from = "$mail_from\@$hostname";
}
@@ -463,6 +469,7 @@
die "usage: $0 REPOS REVNUM [[-m regex] [options] [email_addr ...]] ...\n",
"options are\n",
" -h hostname Hostname to append to author for 'From:'\n",
+ " -e email Email for 'From:' (overrides -h)\n",
" -l logfile File to which mail contents should be appended\n",
" -m regex Regular expression to match committed path\n",
" -r email_address Set email Reply-To header to this email address\n",
@@ -494,6 +501,7 @@
{
return {email_addresses => [],
hostname => '',
+ email => '',
log_file => '',
match_regex => '.',
reply_to => '',
Index: propchange-email.pl
===================================================================
--- propchange-email.pl
+++ propchange-email.pl 2002-12-10 11:41:21.000000000 -0200
@@ -91,7 +91,7 @@
while (@ARGV)
{
my $arg = shift @ARGV;
- if (my ($opt) = $arg =~ /^-([hlmrs])/)
+ if (my ($opt) = $arg =~ /^-([helmrs])/)
{
unless (@ARGV)
{
@@ -102,6 +102,7 @@
# This hash matches the command line option to the hash key in
# the project.
my %opt_to_hash_key = (h => 'hostname',
+ e => 'email',
l => 'log_file',
r => 'reply_to',
s => 'subject_prefix');
@@ -244,6 +245,7 @@
my @email_addresses = @{$project->{email_addresses}};
my $userlist = join(' ', @email_addresses);
my $hostname = $project->{hostname};
+ my $email = $project->{email};
my $log_file = $project->{log_file};
my $reply_to = $project->{reply_to};
my $subject_prefix = $project->{subject_prefix};
@@ -256,7 +258,11 @@
}
my $mail_from = $author;
- if ($hostname =~ /\w/)
+ if ($email =~ /\w/)
+ {
+ $mail_from = "$email";
+ }
+ elsif ($hostname =~ /\w/)
{
$mail_from = "$mail_from\@$hostname";
}
@@ -337,6 +343,7 @@
die "usage: $0 REPOS REVNUM USER PROPNAME [[-m regex] [options] [email_addr ...]] ...\n",
"options are\n",
" -h hostname Hostname to append to author for 'From:'\n",
+ " -e email Email for 'From:' (overrides -h)\n",
" -l logfile File to which mail contents should be appended\n",
" -m regex Regular expression to match committed path\n",
" -r email_address Set email Reply-To header to this email address\n",
--
Gustavo Niemeyer
[ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ]
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Dec 10 15:01:53 2002