Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG8ce3f91d5f6f: patchbomb: use progress helper
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
pulkit |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/patchbomb.py (6 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Martin von Zweigbergk | Jun 18 2018, 5:34 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | D3806 lfs: use progess helper | |
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
parent = '<' + parent | parent = '<' + parent | ||||
if not parent.endswith('>'): | if not parent.endswith('>'): | ||||
parent += '>' | parent += '>' | ||||
sender_addr = eutil.parseaddr(encoding.strfromlocal(sender))[1] | sender_addr = eutil.parseaddr(encoding.strfromlocal(sender))[1] | ||||
sender = mail.addressencode(ui, sender, _charsets, opts.get('test')) | sender = mail.addressencode(ui, sender, _charsets, opts.get('test')) | ||||
sendmail = None | sendmail = None | ||||
firstpatch = None | firstpatch = None | ||||
progress = ui.makeprogress(_('sending'), unit=_('emails'), total=len(msgs)) | |||||
for i, (m, subj, ds) in enumerate(msgs): | for i, (m, subj, ds) in enumerate(msgs): | ||||
try: | try: | ||||
m['Message-Id'] = genmsgid(m['X-Mercurial-Node']) | m['Message-Id'] = genmsgid(m['X-Mercurial-Node']) | ||||
if not firstpatch: | if not firstpatch: | ||||
firstpatch = m['Message-Id'] | firstpatch = m['Message-Id'] | ||||
m['X-Mercurial-Series-Id'] = firstpatch | m['X-Mercurial-Series-Id'] = firstpatch | ||||
except TypeError: | except TypeError: | ||||
m['Message-Id'] = genmsgid('patchbomb') | m['Message-Id'] = genmsgid('patchbomb') | ||||
ui.write('\n') | ui.write('\n') | ||||
except IOError as inst: | except IOError as inst: | ||||
if inst.errno != errno.EPIPE: | if inst.errno != errno.EPIPE: | ||||
raise | raise | ||||
else: | else: | ||||
if not sendmail: | if not sendmail: | ||||
sendmail = mail.connect(ui, mbox=mbox) | sendmail = mail.connect(ui, mbox=mbox) | ||||
ui.status(_('sending '), subj, ' ...\n') | ui.status(_('sending '), subj, ' ...\n') | ||||
ui.progress(_('sending'), i, item=subj, total=len(msgs), | progress.update(i, item=subj) | ||||
unit=_('emails')) | |||||
if not mbox: | if not mbox: | ||||
# Exim does not remove the Bcc field | # Exim does not remove the Bcc field | ||||
del m['Bcc'] | del m['Bcc'] | ||||
fp = stringio() | fp = stringio() | ||||
generator = emailgen.Generator(fp, mangle_from_=False) | generator = emailgen.Generator(fp, mangle_from_=False) | ||||
generator.flatten(m, 0) | generator.flatten(m, 0) | ||||
sendmail(sender_addr, to + bcc + cc, fp.getvalue()) | sendmail(sender_addr, to + bcc + cc, fp.getvalue()) | ||||
ui.progress(_('sending'), None) | progress.complete() |