mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
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.
This commit is contained in:
parent
b8cccccefd
commit
2207d76e14
@ -34,6 +34,7 @@ file::
|
||||
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 @@ def patchbomb(ui, repo, *revs, **opts):
|
||||
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 @@ def patchbomb(ui, repo, *revs, **opts):
|
||||
to = getaddrs('to', 'To')
|
||||
cc = getaddrs('cc', 'Cc', '')
|
||||
bcc = getaddrs('bcc')
|
||||
replyto = getaddrs('reply-to')
|
||||
|
||||
ui.write('\n')
|
||||
|
||||
@ -442,6 +445,8 @@ def patchbomb(ui, repo, *revs, **opts):
|
||||
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 @@ emailopts = [
|
||||
('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', '',
|
||||
|
@ -135,6 +135,14 @@ echo "% test intro for multiple patches"
|
||||
hg email --date '1970-1-1 0:1' -n --intro -f quux -t foo -c bar -s test \
|
||||
-r 0:1 | fixheaders
|
||||
|
||||
echo "% test reply-to via config"
|
||||
hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -r 2 \
|
||||
--config patchbomb.reply-to='baz@example.com' | fixheaders
|
||||
|
||||
echo "% test reply-to via command line"
|
||||
hg email --date '1970-1-1 0:1' -n -f quux -t foo -c bar -s test -r 2 \
|
||||
--reply-to baz --reply-to fred | fixheaders
|
||||
|
||||
echo "% tagging csets"
|
||||
hg tag -r0 zero zero.foo
|
||||
hg tag -r1 one one.patch
|
||||
|
@ -1062,6 +1062,68 @@ diff -r 8580ff50825a -r 97d72e5f12c7 b
|
||||
@@ -0,0 +1,1 @@
|
||||
+b
|
||||
|
||||
% test reply-to via config
|
||||
This patch series consists of 1 patches.
|
||||
|
||||
|
||||
Displaying [PATCH] test ...
|
||||
Content-Type: text/plain; charset="us-ascii"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [PATCH] test
|
||||
X-Mercurial-Node: ff2c9fa2018b15fa74b33363bda9527323e2a99f
|
||||
Message-Id: <ff2c9fa2018b15fa74b3.60@
|
||||
User-Agent: Mercurial-patchbomb
|
||||
Date: Thu, 01 Jan 1970 00:01:00 +0000
|
||||
From: quux
|
||||
To: foo
|
||||
Cc: bar
|
||||
Reply-To: baz@example.com
|
||||
|
||||
# HG changeset patch
|
||||
# User test
|
||||
# Date 3 0
|
||||
# Node ID ff2c9fa2018b15fa74b33363bda9527323e2a99f
|
||||
# Parent 97d72e5f12c7e84f85064aa72e5a297142c36ed9
|
||||
c
|
||||
|
||||
diff -r 97d72e5f12c7 -r ff2c9fa2018b c
|
||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
||||
+++ b/c Thu Jan 01 00:00:03 1970 +0000
|
||||
@@ -0,0 +1,1 @@
|
||||
+c
|
||||
|
||||
% test reply-to via command line
|
||||
This patch series consists of 1 patches.
|
||||
|
||||
|
||||
Displaying [PATCH] test ...
|
||||
Content-Type: text/plain; charset="us-ascii"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [PATCH] test
|
||||
X-Mercurial-Node: ff2c9fa2018b15fa74b33363bda9527323e2a99f
|
||||
Message-Id: <ff2c9fa2018b15fa74b3.60@
|
||||
User-Agent: Mercurial-patchbomb
|
||||
Date: Thu, 01 Jan 1970 00:01:00 +0000
|
||||
From: quux
|
||||
To: foo
|
||||
Cc: bar
|
||||
Reply-To: baz, fred
|
||||
|
||||
# HG changeset patch
|
||||
# User test
|
||||
# Date 3 0
|
||||
# Node ID ff2c9fa2018b15fa74b33363bda9527323e2a99f
|
||||
# Parent 97d72e5f12c7e84f85064aa72e5a297142c36ed9
|
||||
c
|
||||
|
||||
diff -r 97d72e5f12c7 -r ff2c9fa2018b c
|
||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
||||
+++ b/c Thu Jan 01 00:00:03 1970 +0000
|
||||
@@ -0,0 +1,1 @@
|
||||
+c
|
||||
|
||||
% tagging csets
|
||||
% test inline for single named patch
|
||||
This patch series consists of 1 patches.
|
||||
|
Loading…
Reference in New Issue
Block a user