[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Setting email in hook scripts

From: Gustavo Niemeyer <niemeyer_at_conectiva.com>
Date: 2002-12-10 21:57:15 CET

> What would you say about re-submitting using -f (for "from address")
> instead of -e? "email" is quite ambiguous.

You're right. Here is an updated patch. Thank you!

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 =~ /^-([hflmrs])/)
       {
         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',
+ f => 'from_addr',
                                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 $from_addr = $project->{from_addr};
     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 ($from_addr =~ /\w/)
+ {
+ $mail_from = "$from_addr";
+ }
+ 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",
+ " -f from_address Email address 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 => '',
+ from_addr => '',
           log_file => '',
           match_regex => '.',
           reply_to => '',
Index: propchange-email.pl
===================================================================
--- propchange-email.pl
+++ propchange-email.pl 2002-12-10 12:15:43.000000000 -0200
@@ -91,7 +91,7 @@
 while (@ARGV)
   {
     my $arg = shift @ARGV;
- if (my ($opt) = $arg =~ /^-([hlmrs])/)
+ if (my ($opt) = $arg =~ /^-([hflmrs])/)
       {
         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',
+ f => 'from_addr',
                                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 $from_addr = $project->{from_addr};
     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 ($from_addr =~ /\w/)
+ {
+ $mail_from = "$from_addr";
+ }
+ 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",
+ " -f from_address Email address 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",
@@ -369,6 +376,7 @@
 {
   return {email_addresses => [],
           hostname => '',
+ from_addr => '',
           log_file => '',
           match_regex => '.',
           reply_to => '',

-- 
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 21:58:57 2002

This is an archived mail posted to the Subversion Dev mailing list.