hgext/patchbomb.py
changeset 1871 258e3a7955b8
parent 1846 4d2791f4ef80
child 2165 d821918e3bee
equal deleted inserted replaced
1868:6a3d5a56f19c 1871:258e3a7955b8
    50 # cc = cc1, cc2, ...
    50 # cc = cc1, cc2, ...
    51 
    51 
    52 from mercurial.demandload import *
    52 from mercurial.demandload import *
    53 demandload(globals(), '''email.MIMEMultipart email.MIMEText email.Utils
    53 demandload(globals(), '''email.MIMEMultipart email.MIMEText email.Utils
    54                          mercurial:commands,hg,ui
    54                          mercurial:commands,hg,ui
    55                          os popen2 smtplib socket sys tempfile time''')
    55                          os errno popen2 smtplib socket sys tempfile time''')
    56 from mercurial.i18n import gettext as _
    56 from mercurial.i18n import gettext as _
    57 
    57 
    58 try:
    58 try:
    59     # readline gives raw_input editing capabilities, but is not
    59     # readline gives raw_input editing capabilities, but is not
    60     # present on windows
    60     # present on windows
   252         m['To'] = ', '.join(to)
   252         m['To'] = ', '.join(to)
   253         if cc: m['Cc'] = ', '.join(cc)
   253         if cc: m['Cc'] = ', '.join(cc)
   254         if opts['test']:
   254         if opts['test']:
   255             ui.status('Displaying ', m['Subject'], ' ...\n')
   255             ui.status('Displaying ', m['Subject'], ' ...\n')
   256             fp = os.popen(os.getenv('PAGER', 'more'), 'w')
   256             fp = os.popen(os.getenv('PAGER', 'more'), 'w')
   257             fp.write(m.as_string(0))
   257             try:
   258             fp.write('\n')
   258                 fp.write(m.as_string(0))
       
   259                 fp.write('\n')
       
   260             except IOError, inst:
       
   261                 if inst.errno != errno.EPIPE:
       
   262                     raise
   259             fp.close()
   263             fp.close()
   260         elif opts['mbox']:
   264         elif opts['mbox']:
   261             ui.status('Writing ', m['Subject'], ' ...\n')
   265             ui.status('Writing ', m['Subject'], ' ...\n')
   262             fp = open(opts['mbox'], m.has_key('In-Reply-To') and 'ab+' or 'wb+')
   266             fp = open(opts['mbox'], m.has_key('In-Reply-To') and 'ab+' or 'wb+')
   263             date = time.asctime(time.localtime(start_time))
   267             date = time.asctime(time.localtime(start_time))