changeset 38403:8ce3f91d5f6f

patchbomb: use progress helper Differential Revision: https://phab.mercurial-scm.org/D3804
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 18 Jun 2018 14:34:07 -0700
parents 457fa4056286
children 398716063c2d
files hgext/patchbomb.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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()