hgext/patchbomb.py
changeset 3876 ff49da8bd6ae
parent 3468 0e68608bd11d
child 3887 79e5a6e7c451
equal deleted inserted replaced
3875:729f354f3f09 3876:ff49da8bd6ae
   214     bcc = opts['bcc'] or (ui.config('email', 'bcc') or
   214     bcc = opts['bcc'] or (ui.config('email', 'bcc') or
   215                           ui.config('patchbomb', 'bcc') or '').split(',')
   215                           ui.config('patchbomb', 'bcc') or '').split(',')
   216     bcc = [a.strip() for a in bcc if a.strip()]
   216     bcc = [a.strip() for a in bcc if a.strip()]
   217 
   217 
   218     if len(patches) > 1:
   218     if len(patches) > 1:
   219         ui.write(_('\nWrite the introductory message for the patch series.\n\n'))
       
   220 
       
   221         tlen = len(str(len(patches)))
   219         tlen = len(str(len(patches)))
   222 
   220 
   223         subj = '[PATCH %0*d of %d] %s' % (
   221         subj = '[PATCH %0*d of %d] %s' % (
   224             tlen, 0,
   222             tlen, 0,
   225             len(patches),
   223             len(patches),
   226             opts['subject'] or
   224             opts['subject'] or
   227             prompt('Subject:', rest = ' [PATCH %0*d of %d] ' % (tlen, 0,
   225             prompt('Subject:', rest = ' [PATCH %0*d of %d] ' % (tlen, 0,
   228                 len(patches))))
   226                 len(patches))))
   229 
   227 
   230         ui.write(_('Finish with ^D or a dot on a line by itself.\n\n'))
   228         body = ''
   231 
       
   232         body = []
       
   233 
       
   234         while True:
       
   235             try: l = raw_input()
       
   236             except EOFError: break
       
   237             if l == '.': break
       
   238             body.append(l)
       
   239 
       
   240         if opts['diffstat']:
   229         if opts['diffstat']:
   241             d = cdiffstat(_('Final summary:\n'), jumbo)
   230             d = cdiffstat(_('Final summary:\n'), jumbo)
   242             if d: body.append('\n' + d)
   231             if d: body = '\n' + d
   243 
   232 
   244         body = '\n'.join(body) + '\n'
   233         ui.write(_('\nWrite the introductory message for the patch series.\n\n'))
       
   234         body = ui.edit(body, sender)
   245 
   235 
   246         msg = email.MIMEText.MIMEText(body)
   236         msg = email.MIMEText.MIMEText(body)
   247         msg['Subject'] = subj
   237         msg['Subject'] = subj
   248 
   238 
   249         msgs.insert(0, msg)
   239         msgs.insert(0, msg)