hgext/patchbomb.py
changeset 3291 0b5d626b354e
parent 3247 1e2941fda520
child 3468 0e68608bd11d
equal deleted inserted replaced
3290:ae8583e746f1 3291:0b5d626b354e
   156             body += '\n'.join(patch)
   156             body += '\n'.join(patch)
   157             msg = email.MIMEText.MIMEText(body)
   157             msg = email.MIMEText.MIMEText(body)
   158         if total == 1:
   158         if total == 1:
   159             subj = '[PATCH] ' + desc[0].strip()
   159             subj = '[PATCH] ' + desc[0].strip()
   160         else:
   160         else:
   161             subj = '[PATCH %d of %d] %s' % (idx, total, desc[0].strip())
   161             tlen = len(str(total))
       
   162             subj = '[PATCH %0*d of %d] %s' % (tlen, idx, total, desc[0].strip())
   162         if subj.endswith('.'): subj = subj[:-1]
   163         if subj.endswith('.'): subj = subj[:-1]
   163         msg['Subject'] = subj
   164         msg['Subject'] = subj
   164         msg['X-Mercurial-Node'] = node
   165         msg['X-Mercurial-Node'] = node
   165         return msg
   166         return msg
   166 
   167 
   215     bcc = [a.strip() for a in bcc if a.strip()]
   216     bcc = [a.strip() for a in bcc if a.strip()]
   216 
   217 
   217     if len(patches) > 1:
   218     if len(patches) > 1:
   218         ui.write(_('\nWrite the introductory message for the patch series.\n\n'))
   219         ui.write(_('\nWrite the introductory message for the patch series.\n\n'))
   219 
   220 
   220         subj = '[PATCH 0 of %d] %s' % (
   221         tlen = len(str(len(patches)))
       
   222 
       
   223         subj = '[PATCH %0*d of %d] %s' % (
       
   224             tlen, 0,
   221             len(patches),
   225             len(patches),
   222             opts['subject'] or
   226             opts['subject'] or
   223             prompt('Subject:', rest = ' [PATCH 0 of %d] ' % len(patches)))
   227             prompt('Subject:', rest = ' [PATCH %0*d of %d] ' % (tlen, 0,
       
   228                 len(patches))))
   224 
   229 
   225         ui.write(_('Finish with ^D or a dot on a line by itself.\n\n'))
   230         ui.write(_('Finish with ^D or a dot on a line by itself.\n\n'))
   226 
   231 
   227         body = []
   232         body = []
   228 
   233