hgext/patchbomb.py
changeset 36448 39c9f339b692
parent 36446 3d58037c6ec0
child 36449 a918c996a881
equal deleted inserted replaced
36447:588048a6a8d3 36448:39c9f339b692
    73 '''
    73 '''
    74 from __future__ import absolute_import
    74 from __future__ import absolute_import
    75 
    75 
    76 import email as emailmod
    76 import email as emailmod
    77 import email.generator as emailgen
    77 import email.generator as emailgen
       
    78 import email.utils as eutil
    78 import errno
    79 import errno
    79 import os
    80 import os
    80 import socket
    81 import socket
    81 import tempfile
    82 import tempfile
    82 
    83 
   743         if not parent.startswith('<'):
   744         if not parent.startswith('<'):
   744             parent = '<' + parent
   745             parent = '<' + parent
   745         if not parent.endswith('>'):
   746         if not parent.endswith('>'):
   746             parent += '>'
   747             parent += '>'
   747 
   748 
   748     sender_addr = emailmod.Utils.parseaddr(sender)[1]
   749     sender_addr = eutil.parseaddr(sender)[1]
   749     sender = mail.addressencode(ui, sender, _charsets, opts.get('test'))
   750     sender = mail.addressencode(ui, sender, _charsets, opts.get('test'))
   750     sendmail = None
   751     sendmail = None
   751     firstpatch = None
   752     firstpatch = None
   752     for i, (m, subj, ds) in enumerate(msgs):
   753     for i, (m, subj, ds) in enumerate(msgs):
   753         try:
   754         try:
   762             m['References'] = parent
   763             m['References'] = parent
   763         if not parent or 'X-Mercurial-Node' not in m:
   764         if not parent or 'X-Mercurial-Node' not in m:
   764             parent = m['Message-Id']
   765             parent = m['Message-Id']
   765 
   766 
   766         m['User-Agent'] = 'Mercurial-patchbomb/%s' % util.version()
   767         m['User-Agent'] = 'Mercurial-patchbomb/%s' % util.version()
   767         m['Date'] = emailmod.Utils.formatdate(start_time[0], localtime=True)
   768         m['Date'] = eutil.formatdate(start_time[0], localtime=True)
   768 
   769 
   769         start_time = (start_time[0] + 1, start_time[1])
   770         start_time = (start_time[0] + 1, start_time[1])
   770         m['From'] = sender
   771         m['From'] = sender
   771         m['To'] = ', '.join(to)
   772         m['To'] = ', '.join(to)
   772         if cc:
   773         if cc: