[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-12 16:46:37 CET

> At this point, there are multiple patches floating around, and a log
> message, in an old email, that may or may not apply to all of the
> patches.
>
> By including a log message with each posting of the patch, you save
> reviewers time, because they won't have to hunt around old mails
> looking for a log message (and then wonder, when they find it, whether
> it's still up-to-date).
>
> But I think a more general answer is: try to imagine yourself as a
> potential reviewer, and ask yourself "What would make my life easier?"

I'm sorry. I was just suprised to see so many reactions and suggestions
to redo such a simple patch in different ways. By the time of Blair's
message, I wasn't even sure if this patch was going to be accepted with
"-f" or I'd have to change to "--from" or something like that. It's my
intention to save you as much time as possible. OTOH, I'd also
appreciate any tentatives of saving my own scarce time.

> So, can you repost with:
>
> a) the log message for the latest version of the patch
> b) the latest version of the patch
>
> and save us all some confusion? :-)

As a symbol of my good will, and appreciation of your work, here is the
latest version of the patch, including Blair's alphabetical code
reordering suggestion, and a copy of the first log:

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 -f 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-12 12:14:37.000000000 -0200
@@ -90,7 +90,7 @@
 while (@ARGV)
   {
     my $arg = shift @ARGV;
- if (my ($opt) = $arg =~ /^-([hlmrs])/)
+ if (my ($opt) = $arg =~ /^-([fhlmrs])/)
       {
         unless (@ARGV)
           {
@@ -100,7 +100,8 @@
 
         # This hash matches the command line option to the hash key in
         # the project.
- my %opt_to_hash_key = (h => 'hostname',
+ my %opt_to_hash_key = (f => 'from_addr',
+ h => 'hostname',
                                l => 'log_file',
                                r => 'reply_to',
                                s => 'subject_prefix');
@@ -362,6 +363,7 @@
 
     my @email_addresses = @{$project->{email_addresses}};
     my $userlist = join(' ', @email_addresses);
+ my $from_addr = $project->{from_addr};
     my $hostname = $project->{hostname};
     my $log_file = $project->{log_file};
     my $reply_to = $project->{reply_to};
@@ -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";
       }
@@ -462,6 +468,7 @@
   warn "@_\n" if @_;
   die "usage: $0 REPOS REVNUM [[-m regex] [options] [email_addr ...]] ...\n",
       "options are\n",
+ " -f from_address Email address for 'From:' (overrides -h)\n",
       " -h hostname Hostname to append to author for 'From:'\n",
       " -l logfile File to which mail contents should be appended\n",
       " -m regex Regular expression to match committed path\n",
@@ -493,6 +500,7 @@
 sub new_project
 {
   return {email_addresses => [],
+ from_addr => '',
           hostname => '',
           log_file => '',
           match_regex => '.',
Index: propchange-email.pl
===================================================================
--- propchange-email.pl
+++ propchange-email.pl 2002-12-12 12:15:49.000000000 -0200
@@ -91,7 +91,7 @@
 while (@ARGV)
   {
     my $arg = shift @ARGV;
- if (my ($opt) = $arg =~ /^-([hlmrs])/)
+ if (my ($opt) = $arg =~ /^-([fhlmrs])/)
       {
         unless (@ARGV)
           {
@@ -101,7 +101,8 @@
 
         # This hash matches the command line option to the hash key in
         # the project.
- my %opt_to_hash_key = (h => 'hostname',
+ my %opt_to_hash_key = (f => 'from_addr',
+ h => 'hostname',
                                l => 'log_file',
                                r => 'reply_to',
                                s => 'subject_prefix');
@@ -243,6 +244,7 @@
 
     my @email_addresses = @{$project->{email_addresses}};
     my $userlist = join(' ', @email_addresses);
+ my $from_addr = $project->{from_addr};
     my $hostname = $project->{hostname};
     my $log_file = $project->{log_file};
     my $reply_to = $project->{reply_to};
@@ -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";
       }
@@ -336,6 +342,7 @@
   warn "@_\n" if @_;
   die "usage: $0 REPOS REVNUM USER PROPNAME [[-m regex] [options] [email_addr ...]] ...\n",
       "options are\n",
+ " -f from_address Email address for 'From:' (overrides -h)\n",
       " -h hostname Hostname to append to author for 'From:'\n",
       " -l logfile File to which mail contents should be appended\n",
       " -m regex Regular expression to match committed path\n",
@@ -368,6 +375,7 @@
 sub new_project
 {
   return {email_addresses => [],
+ from_addr => '',
           hostname => '',
           log_file => '',
           match_regex => '.',

-- 
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 Thu Dec 12 16:48:40 2002

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.