Mercurial > public > mercurial-scm > hg-stable
diff hgext/patchbomb.py @ 5866:dc6ed2736c81
patchbomb: prompt only once for SMTP password
- simplify mail._sendmail to be a function rather than a class
- simplify connect to return a function rather than a class
- move exception handling from mail.sendmail to mail.connect
- use a single connection for all messages in patchbomb
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 17 Jan 2008 13:51:59 -0600 |
parents | 89ea99c7bdfd |
children | d0576d065993 528c986f0162 |
line wrap: on
line diff
--- a/hgext/patchbomb.py Wed Jan 16 11:32:25 2008 -0600 +++ b/hgext/patchbomb.py Thu Jan 17 13:51:59 2008 -0600 @@ -381,6 +381,7 @@ parent = None sender_addr = email.Utils.parseaddr(sender)[1] + sendmail = None for m in msgs: try: m['Message-Id'] = genmsgid(m['X-Mercurial-Node']) @@ -426,10 +427,12 @@ fp.write('\n\n') fp.close() else: + if not sendmail: + sendmail = mail.connect(ui) ui.status('Sending ', m['Subject'], ' ...\n') # Exim does not remove the Bcc field del m['Bcc'] - mail.sendmail(ui, sender, to + bcc + cc, m.as_string(0)) + sendmail(ui, sender, to + bcc + cc, m.as_string(0)) cmdtable = { "email":