##// END OF EJS Templates
patchbomb: fix parsing of multiple addresses, allow multiple addrs in --to/cc/bcc...
Marti Raudsepp -
r9947:4600e622 default
parent child Browse files
Show More
@@ -379,20 +379,21 b' def patchbomb(ui, repo, *revs, **opts):'
379 else:
379 else:
380 msgs = getpatchmsgs(list(getpatches(revs)))
380 msgs = getpatchmsgs(list(getpatches(revs)))
381
381
382 def getaddrs(opt, prpt, default = None):
382 def getaddrs(opt, prpt=None, default=None):
383 addrs = opts.get(opt) or (ui.config('email', opt) or
383 if opts.get(opt):
384 ui.config('patchbomb', opt) or
384 return mail.addrlistencode(ui, opts.get(opt), _charsets,
385 prompt(ui, prpt, default)).split(',')
385 opts.get('test'))
386 return [mail.addressencode(ui, a.strip(), _charsets, opts.get('test'))
386
387 for a in addrs if a.strip()]
387 addrs = (ui.config('email', opt) or
388 ui.config('patchbomb', opt) or '')
389 if not addrs and prpt:
390 addrs = prompt(ui, prpt, default)
391
392 return mail.addrlistencode(ui, [addrs], _charsets, opts.get('test'))
388
393
389 to = getaddrs('to', 'To')
394 to = getaddrs('to', 'To')
390 cc = getaddrs('cc', 'Cc', '')
395 cc = getaddrs('cc', 'Cc', '')
391
396 bcc = getaddrs('bcc')
392 bcc = opts.get('bcc') or (ui.config('email', 'bcc') or
393 ui.config('patchbomb', 'bcc') or '').split(',')
394 bcc = [mail.addressencode(ui, a.strip(), _charsets, opts.get('test'))
395 for a in bcc if a.strip()]
396
397
397 ui.write('\n')
398 ui.write('\n')
398
399
@@ -169,6 +169,12 b' echo "% test multiple flags for multiple'
169 hg email --date '1970-1-1 0:1' -n --flag fooFlag --flag barFlag -f quux -t foo \
169 hg email --date '1970-1-1 0:1' -n --flag fooFlag --flag barFlag -f quux -t foo \
170 -c bar -s test -r 0:1 | fixheaders
170 -c bar -s test -r 0:1 | fixheaders
171
171
172 echo "% test multi-address parsing"
173 hg email --date '1980-1-1 0:1' -m tmp.mbox -f quux -t 'spam<spam><eggs>' \
174 -t toast -c 'foo,bar@example.com' -c '"A, B <>" <a@example.com>' -s test -r 0 \
175 --config email.bcc='"Quux, A." <quux>'
176 cat tmp.mbox | fixheaders
177
172 echo "% test multi-byte domain parsing"
178 echo "% test multi-byte domain parsing"
173 UUML=`printf '\374'`
179 UUML=`printf '\374'`
174 HGENCODING=iso-8859-1
180 HGENCODING=iso-8859-1
@@ -1469,6 +1469,39 b' diff -r 8580ff50825a -r 97d72e5f12c7 b'
1469 @@ -0,0 +1,1 @@
1469 @@ -0,0 +1,1 @@
1470 +b
1470 +b
1471
1471
1472 % test multi-address parsing
1473 This patch series consists of 1 patches.
1474
1475
1476 Writing [PATCH] test ...
1477 From quux Tue Jan 01 00:01:01 1980
1478 Content-Type: text/plain; charset="us-ascii"
1479 MIME-Version: 1.0
1480 Content-Transfer-Encoding: 7bit
1481 Subject: [PATCH] test
1482 X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab
1483 Message-Id: <8580ff50825a50c8f716.315532860@
1484 User-Agent: Mercurial-patchbomb
1485 Date: Tue, 01 Jan 1980 00:01:00 +0000
1486 From: quux
1487 To: spam <spam>, eggs, toast
1488 Cc: foo, bar@example.com, "A, B <>" <a@example.com>
1489 Bcc: "Quux, A." <quux>
1490
1491 # HG changeset patch
1492 # User test
1493 # Date 1 0
1494 # Node ID 8580ff50825a50c8f716709acdf8de0deddcd6ab
1495 # Parent 0000000000000000000000000000000000000000
1496 a
1497
1498 diff -r 000000000000 -r 8580ff50825a a
1499 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1500 +++ b/a Thu Jan 01 00:00:01 1970 +0000
1501 @@ -0,0 +1,1 @@
1502 +a
1503
1504
1472 % test multi-byte domain parsing
1505 % test multi-byte domain parsing
1473 This patch series consists of 1 patches.
1506 This patch series consists of 1 patches.
1474
1507
General Comments 0
You need to be logged in to leave comments. Login now