diff hgext/patchbomb.py @ 11150:f66ca4431eb9

patchbomb: Reply-To support From RFC 5322: an optional reply-to field MAY also be included, which contains the field name "Reply-To" and a comma-separated list of one or more addresses. [...] When the "Reply-To:" field is present, it indicates the address(es) to which the author of the message suggests that replies be sent. In the absence of the "Reply-To:" field, replies SHOULD by default be sent to the mailbox(es) specified in the "From:" field unless otherwise specified by the person composing the reply. Reply-To addresses may be specified either via command line with --reply-to or via the 'email' or 'patchbomb' sections of the config file.
author C?dric Duval <cedricduval@free.fr>
date Mon, 10 May 2010 22:06:28 +0200
parents 49a07f441496
children b25464e9b448
line wrap: on
line diff
--- a/hgext/patchbomb.py	Mon May 10 11:04:56 2010 -0500
+++ b/hgext/patchbomb.py	Mon May 10 22:06:28 2010 +0200
@@ -34,6 +34,7 @@
   to = recipient1, recipient2, ...
   cc = cc1, cc2, ...
   bcc = bcc1, bcc2, ...
+  reply-to = address1, address2, ...
 
 Use ``[patchbomb]`` as configuration section name if you need to
 override global ``[email]`` address settings.
@@ -390,8 +391,9 @@
         msgs = getpatchmsgs(list(getpatches(revs)))
 
     def getaddrs(opt, prpt=None, default=None):
-        if opts.get(opt):
-            return mail.addrlistencode(ui, opts.get(opt), _charsets,
+        addrs = opts.get(opt.replace('-', '_'))
+        if addrs:
+            return mail.addrlistencode(ui, addrs, _charsets,
                                        opts.get('test'))
 
         addrs = (ui.config('email', opt) or
@@ -404,6 +406,7 @@
     to = getaddrs('to', 'To')
     cc = getaddrs('cc', 'Cc', '')
     bcc = getaddrs('bcc')
+    replyto = getaddrs('reply-to')
 
     ui.write('\n')
 
@@ -442,6 +445,8 @@
             m['Cc']  = ', '.join(cc)
         if bcc:
             m['Bcc'] = ', '.join(bcc)
+        if replyto:
+            m['Reply-To'] = ', '.join(replyto)
         if opts.get('test'):
             ui.status(_('Displaying '), subj, ' ...\n')
             ui.flush()
@@ -493,6 +498,7 @@
           ('n', 'test', None, _('print messages that would be sent')),
           ('m', 'mbox', '',
            _('write messages to mbox file instead of sending them')),
+          ('', 'reply-to', [], _('email addresses replies should be sent to')),
           ('s', 'subject', '',
            _('subject of first message (intro or single patch)')),
           ('', 'in-reply-to', '',