hgext/patchbomb.py
changeset 43576 14b96072797d
parent 43506 9f70512ae2cf
child 43578 cbcd72844df1
equal deleted inserted replaced
43575:67b4439c09b2 43576:14b96072797d
   941         m[b'User-Agent'] = b'Mercurial-patchbomb/%s' % util.version()
   941         m[b'User-Agent'] = b'Mercurial-patchbomb/%s' % util.version()
   942         m[b'Date'] = eutil.formatdate(start_time[0], localtime=True)
   942         m[b'Date'] = eutil.formatdate(start_time[0], localtime=True)
   943 
   943 
   944         start_time = (start_time[0] + 1, start_time[1])
   944         start_time = (start_time[0] + 1, start_time[1])
   945         m[b'From'] = sender
   945         m[b'From'] = sender
   946         m[b'To'] = b', '.join(to)
   946         m[b'To'] = ', '.join(to)
   947         if cc:
   947         if cc:
   948             m[b'Cc'] = b', '.join(cc)
   948             m[b'Cc'] = ', '.join(cc)
   949         if bcc:
   949         if bcc:
   950             m[b'Bcc'] = b', '.join(bcc)
   950             m[b'Bcc'] = ', '.join(bcc)
   951         if replyto:
   951         if replyto:
   952             m[b'Reply-To'] = b', '.join(replyto)
   952             m[b'Reply-To'] = ', '.join(replyto)
   953         # Fix up all headers to be native strings.
   953         # Fix up all headers to be native strings.
   954         # TODO(durin42): this should probably be cleaned up above in the future.
   954         # TODO(durin42): this should probably be cleaned up above in the future.
   955         if pycompat.ispy3:
   955         if pycompat.ispy3:
   956             for hdr, val in list(m.items()):
   956             for hdr, val in list(m.items()):
   957                 change = False
   957                 change = False
   990                 del m[b'Bcc']
   990                 del m[b'Bcc']
   991             fp = stringio()
   991             fp = stringio()
   992             generator = mail.Generator(fp, mangle_from_=False)
   992             generator = mail.Generator(fp, mangle_from_=False)
   993             generator.flatten(m, 0)
   993             generator.flatten(m, 0)
   994             alldests = to + bcc + cc
   994             alldests = to + bcc + cc
   995             alldests = [encoding.strfromlocal(d) for d in alldests]
       
   996             sendmail(sender_addr, alldests, fp.getvalue())
   995             sendmail(sender_addr, alldests, fp.getvalue())
   997 
   996 
   998     progress.complete()
   997     progress.complete()