You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Gustavo Niemeyer <ni...@conectiva.com> on 2002/12/10 14:00:15 UTC

[PATCH] Setting email in hook scripts

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

Re: [PATCH] Setting email in hook scripts

Posted by Blair Zajac <bl...@orcaware.com>.
Gustavo Niemeyer wrote:
> * 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.

Thanks.  Sorry this wasn't that easy to get into the tree, hopefully
the next patch will be.  Applied in rev 4111, with the --from change.

Also, fyi with when setting a variable to another one in Perl, you
don't need "'s around the variable.  In some cases, you can change
the variable, such if its an object, because it'll stringify the
variable and remove its objectness.

> +    if ($from_addr =~ /\w/)
> +      {
> +        $mail_from = "$from_addr";
> +      }

Best,
Blair

-- 
Blair Zajac <bl...@orcaware.com>
Plots of your system's performance - http://www.orcaware.com/orca/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Setting email in hook scripts

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Gustavo Niemeyer <ni...@conectiva.com> writes:
> > Okay.  By the way, yes, I'm pretty convinced it should be a long
> > "--from" option, but obviously if you don't have time to rework the
> > patch, then the reviewer/applier can take care of it.  However, if you
> > are already familiar with the option parsing code, it might be fast
> > for you to do it; just let us know either way.
> 
> I beg your pardon, but I'm not going to rewrite that patch
> another time, at least for now. If nobody do this, the next time
> I fiddle with that script, I'll fix it.

No need to beg anyone's pardon, you've done enough work already :-).

-K

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Setting email in hook scripts

Posted by Gustavo Niemeyer <ni...@conectiva.com>.
> Okay.  By the way, yes, I'm pretty convinced it should be a long
> "--from" option, but obviously if you don't have time to rework the
> patch, then the reviewer/applier can take care of it.  However, if you
> are already familiar with the option parsing code, it might be fast
> for you to do it; just let us know either way.

I beg your pardon, but I'm not going to rewrite that patch
another time, at least for now. If nobody do this, the next time
I fiddle with that script, I'll fix it.

> +1 on the general change, of course.
> 
> I've got a medium-sized list of saved patches to go through right now;
> I'll start reviewing them.  Any that are trivial to apply, I'll apply
> right away, the rest I'll create `PATCH' issues for.

Thank you for doing that job!

-- 
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

Re: [PATCH] Setting email in hook scripts

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Gustavo Niemeyer <ni...@conectiva.com> writes:
> 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.

Understood, but remember that for every one patch submitter, there are
many, many patch reviewers.  So we try to optimize the process to the
needs of the many.

> 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:

Thank you!

> 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.

Okay.  By the way, yes, I'm pretty convinced it should be a long
"--from" option, but obviously if you don't have time to rework the
patch, then the reviewer/applier can take care of it.  However, if you
are already familiar with the option parsing code, it might be fast
for you to do it; just let us know either way.

+1 on the general change, of course.

I've got a medium-sized list of saved patches to go through right now;
I'll start reviewing them.  Any that are trivial to apply, I'll apply
right away, the rest I'll create `PATCH' issues for.

Thanks for your patience,
-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Setting email in hook scripts

Posted by Blair Zajac <bl...@orcaware.com>.
Gustavo Niemeyer wrote:
> 
> 
> 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.

Working on applying this patch with the --from change, just so nobody
else starts work on it.

Best,
Blair

-- 
Blair Zajac <bl...@orcaware.com>
Plots of your system's performance - http://www.orcaware.com/orca/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Setting email in hook scripts

Posted by Gustavo Niemeyer <ni...@conectiva.com>.
> 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

Re: [PATCH] Setting email in hook scripts

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Gustavo Niemeyer <ni...@conectiva.com> writes:
> > Also, a log message as described in HACKING would be useful.
> 
> Is there any problem with the log message I sent in the first message?

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?"

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? :-)

Thanks,
-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Setting email in hook scripts

Posted by Gustavo Niemeyer <ni...@conectiva.com>.
> Minor nit.  Can you keep the options in alphebetical order, in the
> lines:

bikeshed! :-)

If that's a suggestion that I should apply the patch by myself, I can do
that when I find the time to apply it. Otherwise I'll let for the person
doing that to change the order.

> Also, a log message as described in HACKING would be useful.

Is there any problem with the log message I sent in the first message?

-- 
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

Re: [PATCH] Setting email in hook scripts

Posted by Blair Zajac <bl...@orcaware.com>.
Gustavo Niemeyer wrote:
> 
> > 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!

Minor nit.  Can you keep the options in alphebetical order, in the
lines:

> +    if (my ($opt) = $arg =~ /^-([hflmrs])/)
>          my %opt_to_hash_key = (h => 'hostname',
> +                               f => 'from_addr',
>                                 l => 'log_file',

Also, a log message as described in HACKING would be useful.

Best,
Blair

-- 
Blair Zajac <bl...@orcaware.com>
Plots of your system's performance - http://www.orcaware.com/orca/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Setting email in hook scripts

Posted by Blair Zajac <bl...@orcaware.com>.
Gustavo Niemeyer wrote:
> 
> > 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!

Minor nit.  Can you keep the options in alphabetical order, in the
lines:

> +    if (my ($opt) = $arg =~ /^-([hflmrs])/)
>          my %opt_to_hash_key = (h => 'hostname',
> +                               f => 'from_addr',
>                                 l => 'log_file',

Also, a log message as described in HACKING would be useful.

Best,
Blair

-- 
Blair Zajac <bl...@orcaware.com>
Plots of your system's performance - http://www.orcaware.com/orca/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Setting email in hook scripts

Posted by Gustavo Niemeyer <ni...@conectiva.com>.
> 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

Re: [PATCH] Setting email in hook scripts

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Gustavo Niemeyer <ni...@conectiva.com> writes:

> > +1, it's not an option that I forsee being used in the common case.
> 
> Seriously, I belive it's less usual to see every commiting user
> with an account in the same machine, than delivering the message
> from a single account, or doing some mapping like "username -> email".

Not for my use cases.
-- 

Daniel Rall <dl...@finemaltcoding.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Setting email in hook scripts

Posted by Gustavo Niemeyer <ni...@conectiva.com>.
> +1, it's not an option that I forsee being used in the common case.

Seriously, I belive it's less usual to see every commiting user
with an account in the same machine, than delivering the message
from a single account, or doing some mapping like "username -> email".

-- 
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

Re: [PATCH] Setting email in hook scripts

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Karl Fogel <kf...@newton.ch.collab.net> writes:

> cmpilato@collab.net writes:
> > What would you say about re-submitting using -f (for "from address")
> > instead of -e?  "email" is quite ambiguous.
> 
> How about `--from' and not using up the short option?  It's not a
> script that users invoke by hand very often anyway, and if we do -f
> now, we'll never be able to change it to mean --file or something more
> conventional.

+1, it's not an option that I forsee being used in the common case.
-- 

Daniel Rall <dl...@finemaltcoding.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Setting email in hook scripts

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
cmpilato@collab.net writes:
> What would you say about re-submitting using -f (for "from address")
> instead of -e?  "email" is quite ambiguous.

How about `--from' and not using up the short option?  It's not a
script that users invoke by hand very often anyway, and if we do -f
now, we'll never be able to change it to mean --file or something more
conventional.

(IIRC, `-f' meaning `from' is true for sendmail but not much else.)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Setting email in hook scripts

Posted by cm...@collab.net.
Gustavo Niemeyer <ni...@conectiva.com> writes:

> 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.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Setting email in hook scripts

Posted by Gustavo Niemeyer <ni...@conectiva.com>.
Sorry, there was a missing initalization. Here is a new patch:

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 12:15:43.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",
@@ -369,6 +376,7 @@
 {
   return {email_addresses => [],
           hostname        => '',
+          email           => '',
           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