You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@gmail.com> on 2009/01/21 11:27:41 UTC
Re: [PATCH] fix for incorrect/missing mail headers in
commit-email.pl
I take it that your system somehow allows for altering the invocation
of the commit-email.pl script? As each user wants to receive email,
they simply throw themselves onto the command line?
This would seem to imply that the hook script which invokes
commit-email gets rewritten each time somebody wants to receive an
email. It seems that you could have a simple mailer.conf per
repository, a constant hook script, and your system just rewrites the
.conf to append/remove people from the to_addr list. Would that work
in your situation?
[looking at mailer.py and commit-email stuffs today]
Cheers,
-g
On Tue, Nov 11, 2008 at 08:12, Michiel Holtkamp <mi...@elfstone.nl> wrote:
> For mailer question, see below.
>
> On Nov 11, 2008, at 16:01 , Daniel Shahaf wrote:
>
>> I'm not wearing my PM hat in this thread. The place to ask is the list,
>> so CCing them, maybe they'll know the answer to your question.
>
> Whoops, I missed that.
>
> Ok list, does anyone have an answer to the following question?
>
> I'm using commit-email.pl for my project (http://supermind.nl/submin/)
> sousers can configure themselves if they want to receive email for every
> commit. It seems that mailer.py is not able to send emails without
> specifying alle the emails in the config-file. To write a specific
> config-file each commit (or check if users changed their settings since the
> last commit) seems a bit bothersome and error-prone to me.
>
> Is there a better solution, other than using commit-email.pl (deprecated) or
> mailer.py (only email addresses in config file)?
>
> Thanks in advance,
> Michiel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1040899
Re: [PATCH] fix for incorrect/missing mail headers in
commit-email.pl
Posted by Michiel Holtkamp <mi...@elfstone.nl>.
On Jan 21, 2009, at 22:02 , Martin Furter wrote:
> I guess it's easier to manage a text file containing one To: address
> per line instead of a config file.
> The following (untested) patch adds that feature to mailer.py .
> (I can't test it since I do not have the bindings installed yet, but
> I'll do if there's interest in this feature.)
I have interest in this feature if it's not too troublesome to
maintain, but it looks simple enough. This would be a little bit
easier to automate.
Thanks for the input!
Regards,
Michiel
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1041163
Re: [PATCH] fix for incorrect/missing mail headers in
commit-email.pl
Posted by Michiel Holtkamp <mi...@elfstone.nl>.
On Jan 21, 2009, at 22:15 , Greg Stein wrote:
> The config file doesn't need a whole lot in it. You could do
> something like:
>
> [general]
> mail_command = /usr/sbin/sendmail
> [defaults]
> from_addr = noreply@example.com
> generate_diffs = add copy modify
> to_addr =
> john@example.com
> jane@example.com
> third@example.com
Ok, I guess there is something to say to keep the mailer.py as simple
as possible. I can work with this just as well.
> IOW, it would be just like a file with a list of addresses, but with a
> few lines of prefix.
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1041173
Re: [PATCH] fix for incorrect/missing mail headers in
commit-email.pl
Posted by Greg Stein <gs...@gmail.com>.
On Wed, Jan 21, 2009 at 14:02, Martin Furter <mf...@rola.ch> wrote:
>
> I guess it's easier to manage a text file containing one To: address per
> line instead of a config file.
> The following (untested) patch adds that feature to mailer.py .
> (I can't test it since I do not have the bindings installed yet, but I'll do
> if there's interest in this feature.)
The config file doesn't need a whole lot in it. You could do something like:
[general]
mail_command = /usr/sbin/sendmail
[defaults]
from_addr = noreply@example.com
generate_diffs = add copy modify
to_addr =
john@example.com
jane@example.com
third@example.com
IOW, it would be just like a file with a list of addresses, but with a
few lines of prefix.
Cheers,
-g
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1041169
Re: [PATCH] fix for incorrect/missing mail headers in
commit-email.pl
Posted by Martin Furter <mf...@rola.ch>.
I guess it's easier to manage a text file containing one To: address per
line instead of a config file.
The following (untested) patch adds that feature to mailer.py .
(I can't test it since I do not have the bindings installed yet, but I'll
do if there's interest in this feature.)
Martin
[[[
Add support for reading a file containing one To: address per line.
* tools/hook-scripts/mailer/mailer.py:
(MailedOutput.start): Read to_addr_file if set in the config file.
* tools/hook-scripts/mailer/mailer.conf.example: Add to_addr_file.
]]]
Index: tools/hook-scripts/mailer/mailer.py
===================================================================
--- tools/hook-scripts/mailer/mailer.py (revision 35361)
+++ tools/hook-scripts/mailer/mailer.py (working copy)
@@ -224,18 +224,29 @@
OutputBase.__init__(self, cfg, repos, prefix_param)
def start(self, group, params):
- # whitespace (or another character) separated list of addresses
- # which must be split into a clean list
- to_addr_in = self.cfg.get('to_addr', group, params)
- # if list of addresses starts with '[.]'
- # use the character between the square brackets as split char
- # else use whitespaces
- if len(to_addr_in) >= 3 and to_addr_in[0] == '[' \
- and to_addr_in[2] == ']':
- self.to_addrs = \
- [_f for _f in to_addr_in[3:].split(to_addr_in[1]) if _f]
+ to_addr_file = self.cfg.get('to_addr_file', group, params)
+ if len(to_addr_file) > 0:
+ # read to_addr_file containing one To: address per line
+ self.to_addrs = []
+ inputfile = open(to_addr_file, "r")
+ for to_addr in inputfile:
+ to_addr = to_addr.strip()
+ if len(to_addr) > 0:
+ self.to_addrs.append(to_addr.strip())
+ inputfile.close()
else:
- self.to_addrs = [_f for _f in to_addr_in.split() if _f]
+ # whitespace (or another character) separated list of addresses
+ # which must be split into a clean list
+ to_addr_in = self.cfg.get('to_addr', group, params)
+ # if list of addresses starts with '[.]'
+ # use the character between the square brackets as split char
+ # else use whitespaces
+ if len(to_addr_in) >= 3 and to_addr_in[0] == '[' \
+ and to_addr_in[2] == ']':
+ self.to_addrs = \
+ [_f for _f in to_addr_in[3:].split(to_addr_in[1]) if _f]
+ else:
+ self.to_addrs = [_f for _f in to_addr_in.split() if _f]
self.from_addr = self.cfg.get('from_addr', group, params) \
or self.repos.author or 'no_author'
# if the from_addr (also) starts with '[.]' (may happen if one
Index: tools/hook-scripts/mailer/mailer.conf.example
===================================================================
--- tools/hook-scripts/mailer/mailer.conf.example (revision 35361)
+++ tools/hook-scripts/mailer/mailer.conf.example (working copy)
@@ -173,6 +173,10 @@
# brackets '[ ]'.
to_addr = invalid@example.com
+# Name of a file containing one To: address per line. If this entry
+# is not empty above to_addr will be ignored.
+to_addr_file =
+
# If this is set, then a Reply-To: will be inserted into the message.
reply_to =
On Wed, 21 Jan 2009, Greg Stein wrote:
> I take it that your system somehow allows for altering the invocation
> of the commit-email.pl script? As each user wants to receive email,
> they simply throw themselves onto the command line?
>
> This would seem to imply that the hook script which invokes
> commit-email gets rewritten each time somebody wants to receive an
> email. It seems that you could have a simple mailer.conf per
> repository, a constant hook script, and your system just rewrites the
> .conf to append/remove people from the to_addr list. Would that work
> in your situation?
>
> [looking at mailer.py and commit-email stuffs today]
>
> Cheers,
> -g
>
> On Tue, Nov 11, 2008 at 08:12, Michiel Holtkamp <mi...@elfstone.nl> wrote:
>> For mailer question, see below.
>>
>> On Nov 11, 2008, at 16:01 , Daniel Shahaf wrote:
>>
>>> I'm not wearing my PM hat in this thread. The place to ask is the list,
>>> so CCing them, maybe they'll know the answer to your question.
>>
>> Whoops, I missed that.
>>
>> Ok list, does anyone have an answer to the following question?
>>
>> I'm using commit-email.pl for my project (http://supermind.nl/submin/)
>> sousers can configure themselves if they want to receive email for every
>> commit. It seems that mailer.py is not able to send emails without
>> specifying alle the emails in the config-file. To write a specific
>> config-file each commit (or check if users changed their settings since the
>> last commit) seems a bit bothersome and error-prone to me.
>>
>> Is there a better solution, other than using commit-email.pl (deprecated) or
>> mailer.py (only email addresses in config file)?
>>
>> Thanks in advance,
>> Michiel
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
>> For additional commands, e-mail: dev-help@subversion.tigris.org
>>
>>
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1040899
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1041153
Re: [PATCH] fix for incorrect/missing mail headers in
commit-email.pl
Posted by Michiel Holtkamp <mi...@elfstone.nl>.
On Jan 21, 2009, at 21:09 , Greg Stein wrote:
> Yup. Could get to be quite slow, re-reading the repository each time
> to generate the email. Not to mention that commit-email forks off
> svnlook for its operation rather than binding to the libraries.
Another reason to change this.
> If you want to maintain confidentiality, then I believe that you could
> auto-generate N "groups" in the mailer.conf file, each with a
> different to_addr value. mailer.py will then deliver one message per
> group, each addressed to a single person. The changeset will be
> computed once, although it will re-execute the diff logic for each
> message.
Ok, thanks for the tip! I'll add it to the bug tracking ticket.
> Well... you could construct a .conf file on-the-fly in /tmp, run
> mailer.py, and then remove the file.
Oh yeah, thought about that option too, but forgot to include it in my
email. I don't like temporary files either, too much hassle to do it
safe and correctly. I'll probably go for the one-mailer-conf-per-
repository-with-N-groups then.
Regards,
Michiel
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1041083