diff hgext/patchbomb.py @ 15559:1830d0cc4bc1

patchbomb: minor refactoring of mbox functionality, preparing for move This allows reuse of the mbox functionality but causes minor changes in the patchbomb console output when writing to a mbox.
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 23 Nov 2011 02:09:38 +0100
parents 9ec9dd8d1b24
children cc58c228503e
line wrap: on
line diff
--- a/hgext/patchbomb.py	Wed Nov 23 03:14:24 2011 +0100
+++ b/hgext/patchbomb.py	Wed Nov 23 02:09:38 2011 +0100
@@ -533,14 +533,13 @@
             if fp is not ui:
                 fp.close()
         elif mbox:
-            ui.status(_('Writing '), subj, ' ...\n')
-            ui.progress(_('writing'), i, item=subj, total=len(msgs))
-            fp = open(mbox, 'In-Reply-To' in m and 'ab+' or 'wb+')
+            ui.status(_('Sending '), subj, ' ...\n')
+            ui.progress(_('sending'), i, item=subj, total=len(msgs))
+            fp = open(mbox, i > 0 and 'ab+' or 'wb+')
             generator = email.Generator.Generator(fp, mangle_from_=True)
             # Should be time.asctime(), but Windows prints 2-characters day
             # of month instead of one. Make them print the same thing.
-            date = time.strftime('%a %b %d %H:%M:%S %Y',
-                                 time.localtime(start_time[0]))
+            date = time.strftime('%a %b %d %H:%M:%S %Y', time.localtime())
             fp.write('From %s %s\n' % (sender_addr, date))
             generator.flatten(m, 0)
             fp.write('\n\n')
@@ -555,7 +554,7 @@
             fp = cStringIO.StringIO()
             generator = email.Generator.Generator(fp, mangle_from_=False)
             generator.flatten(m, 0)
-            sendmail(sender, to + bcc + cc, fp.getvalue())
+            sendmail(sender_addr, to + bcc + cc, fp.getvalue())
 
     ui.progress(_('writing'), None)
     ui.progress(_('sending'), None)