hgext/patchbomb.py
changeset 4144 03e9c22a6489
parent 4029 9210fba03d16
parent 4142 ba3e13306f70
child 4257 f51317e24114
equal deleted inserted replaced
4140:193e0f8d9a47 4144:03e9c22a6489
   152             p['Content-Disposition'] = 'inline; filename=' + patchname
   152             p['Content-Disposition'] = 'inline; filename=' + patchname
   153             msg.attach(p)
   153             msg.attach(p)
   154         else:
   154         else:
   155             body += '\n'.join(patch)
   155             body += '\n'.join(patch)
   156             msg = email.MIMEText.MIMEText(body)
   156             msg = email.MIMEText.MIMEText(body)
       
   157 
       
   158         subj = desc[0].strip().rstrip('. ')
   157         if total == 1:
   159         if total == 1:
   158             subj = '[PATCH] ' + desc[0].strip()
   160             subj = '[PATCH] ' + (opts['subject'] or subj)
   159         else:
   161         else:
   160             tlen = len(str(total))
   162             tlen = len(str(total))
   161             subj = '[PATCH %0*d of %d] %s' % (tlen, idx, total, desc[0].strip())
   163             subj = '[PATCH %0*d of %d] %s' % (tlen, idx, total, subj)
   162         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 
   167     start_time = util.makedate()
   168     start_time = util.makedate()
   296       ('g', 'git', None, _('use git extended diff format')),
   297       ('g', 'git', None, _('use git extended diff format')),
   297       ('f', 'from', '', 'email address of sender'),
   298       ('f', 'from', '', 'email address of sender'),
   298       ('', 'plain', None, 'omit hg patch header'),
   299       ('', 'plain', None, 'omit hg patch header'),
   299       ('n', 'test', None, 'print messages that would be sent'),
   300       ('n', 'test', None, 'print messages that would be sent'),
   300       ('m', 'mbox', '', 'write messages to mbox file instead of sending them'),
   301       ('m', 'mbox', '', 'write messages to mbox file instead of sending them'),
   301       ('s', 'subject', '', 'subject of introductory message'),
   302       ('s', 'subject', '', 'subject of first message (intro or single patch)'),
   302       ('t', 'to', [], 'email addresses of recipients')],
   303       ('t', 'to', [], 'email addresses of recipients')],
   303      "hg email [OPTION]... [REV]...")
   304      "hg email [OPTION]... [REV]...")
   304     }
   305     }