##// END OF EJS Templates
patchbomb: show progress when sending emails or writing mbox
Yuya Nishihara -
r12265:1ed2dc9d default
parent child Browse files
Show More
@@ -438,7 +438,7 b' def patchbomb(ui, repo, *revs, **opts):'
438 sender_addr = email.Utils.parseaddr(sender)[1]
438 sender_addr = email.Utils.parseaddr(sender)[1]
439 sender = mail.addressencode(ui, sender, _charsets, opts.get('test'))
439 sender = mail.addressencode(ui, sender, _charsets, opts.get('test'))
440 sendmail = None
440 sendmail = None
441 for m, subj, ds in msgs:
441 for i, (m, subj, ds) in enumerate(msgs):
442 try:
442 try:
443 m['Message-Id'] = genmsgid(m['X-Mercurial-Node'])
443 m['Message-Id'] = genmsgid(m['X-Mercurial-Node'])
444 except TypeError:
444 except TypeError:
@@ -480,6 +480,7 b' def patchbomb(ui, repo, *revs, **opts):'
480 fp.close()
480 fp.close()
481 elif mbox:
481 elif mbox:
482 ui.status(_('Writing '), subj, ' ...\n')
482 ui.status(_('Writing '), subj, ' ...\n')
483 ui.progress(_('writing'), i, item=subj, total=len(msgs))
483 fp = open(mbox, 'In-Reply-To' in m and 'ab+' or 'wb+')
484 fp = open(mbox, 'In-Reply-To' in m and 'ab+' or 'wb+')
484 generator = email.Generator.Generator(fp, mangle_from_=True)
485 generator = email.Generator.Generator(fp, mangle_from_=True)
485 # Should be time.asctime(), but Windows prints 2-characters day
486 # Should be time.asctime(), but Windows prints 2-characters day
@@ -494,6 +495,7 b' def patchbomb(ui, repo, *revs, **opts):'
494 if not sendmail:
495 if not sendmail:
495 sendmail = mail.connect(ui)
496 sendmail = mail.connect(ui)
496 ui.status(_('Sending '), subj, ' ...\n')
497 ui.status(_('Sending '), subj, ' ...\n')
498 ui.progress(_('sending'), i, item=subj, total=len(msgs))
497 # Exim does not remove the Bcc field
499 # Exim does not remove the Bcc field
498 del m['Bcc']
500 del m['Bcc']
499 fp = cStringIO.StringIO()
501 fp = cStringIO.StringIO()
@@ -501,6 +503,9 b' def patchbomb(ui, repo, *revs, **opts):'
501 generator.flatten(m, 0)
503 generator.flatten(m, 0)
502 sendmail(sender, to + bcc + cc, fp.getvalue())
504 sendmail(sender, to + bcc + cc, fp.getvalue())
503
505
506 ui.progress(_('writing'), None)
507 ui.progress(_('sending'), None)
508
504 emailopts = [
509 emailopts = [
505 ('a', 'attach', None, _('send patches as attachments')),
510 ('a', 'attach', None, _('send patches as attachments')),
506 ('i', 'inline', None, _('send patches as inline attachments')),
511 ('i', 'inline', None, _('send patches as inline attachments')),
General Comments 0
You need to be logged in to leave comments. Login now