patchbomb: use progress helper
Differential Revision: https://phab.mercurial-scm.org/D3804
--- a/hgext/patchbomb.py Mon Jun 18 14:32:12 2018 -0700
+++ b/hgext/patchbomb.py Mon Jun 18 14:34:07 2018 -0700
@@ -751,6 +751,7 @@
sender = mail.addressencode(ui, sender, _charsets, opts.get('test'))
sendmail = None
firstpatch = None
+ progress = ui.makeprogress(_('sending'), unit=_('emails'), total=len(msgs))
for i, (m, subj, ds) in enumerate(msgs):
try:
m['Message-Id'] = genmsgid(m['X-Mercurial-Node'])
@@ -791,8 +792,7 @@
if not sendmail:
sendmail = mail.connect(ui, mbox=mbox)
ui.status(_('sending '), subj, ' ...\n')
- ui.progress(_('sending'), i, item=subj, total=len(msgs),
- unit=_('emails'))
+ progress.update(i, item=subj)
if not mbox:
# Exim does not remove the Bcc field
del m['Bcc']
@@ -801,4 +801,4 @@
generator.flatten(m, 0)
sendmail(sender_addr, to + bcc + cc, fp.getvalue())
- ui.progress(_('sending'), None)
+ progress.complete()