Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/patchbomb.py @ 5472:23889160905a 0.9.5
Catch smtp exceptions
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Fri, 07 Sep 2007 16:48:42 +0200 |
parents | 2f09df302f30 |
children | 5223c360503e |
comparison
equal
deleted
inserted
replaced
5471:5b81c1cc6ebe | 5472:23889160905a |
---|---|
222 os.unlink(tmpfn) | 222 os.unlink(tmpfn) |
223 except: | 223 except: |
224 pass | 224 pass |
225 os.rmdir(tmpdir) | 225 os.rmdir(tmpdir) |
226 | 226 |
227 really_sending = not (opts['test'] or opts['mbox']) | 227 if not (opts['test'] or opts['mbox']): |
228 | 228 # really sending |
229 if really_sending: | |
230 mail.validateconfig(ui) | 229 mail.validateconfig(ui) |
231 | 230 |
232 if not (revs or opts.get('rev') or opts.get('outgoing')): | 231 if not (revs or opts.get('rev') or opts.get('outgoing')): |
233 raise util.Abort(_('specify at least one changeset with -r or -o')) | 232 raise util.Abort(_('specify at least one changeset with -r or -o')) |
234 | 233 |
359 ui.config('patchbomb', 'bcc') or '').split(',') | 358 ui.config('patchbomb', 'bcc') or '').split(',') |
360 bcc = [a.strip() for a in bcc if a.strip()] | 359 bcc = [a.strip() for a in bcc if a.strip()] |
361 | 360 |
362 ui.write('\n') | 361 ui.write('\n') |
363 | 362 |
364 if really_sending: | |
365 mailer = mail.connect(ui) | |
366 parent = None | 363 parent = None |
367 | 364 |
368 sender_addr = email.Utils.parseaddr(sender)[1] | 365 sender_addr = email.Utils.parseaddr(sender)[1] |
369 for m in msgs: | 366 for m in msgs: |
370 try: | 367 try: |
409 fp.close() | 406 fp.close() |
410 else: | 407 else: |
411 ui.status('Sending ', m['Subject'], ' ...\n') | 408 ui.status('Sending ', m['Subject'], ' ...\n') |
412 # Exim does not remove the Bcc field | 409 # Exim does not remove the Bcc field |
413 del m['Bcc'] | 410 del m['Bcc'] |
414 mailer.sendmail(sender, to + bcc + cc, m.as_string(0)) | 411 mail.sendmail(ui, sender, to + bcc + cc, m.as_string(0)) |
415 | 412 |
416 cmdtable = { | 413 cmdtable = { |
417 "email": | 414 "email": |
418 (patchbomb, | 415 (patchbomb, |
419 [('a', 'attach', None, _('send patches as inline attachments')), | 416 [('a', 'attach', None, _('send patches as inline attachments')), |