hgext/patchbomb.py
changeset 7360 42f1b8cb9a60
parent 7359 b0fa5dbd9cdd
child 7413 0b6428da1f22
equal deleted inserted replaced
7359:b0fa5dbd9cdd 7360:42f1b8cb9a60
   170     else:
   170     else:
   171         body += '\n'.join(patch)
   171         body += '\n'.join(patch)
   172         msg = mail.mimetextpatch(body, display=opts.get('test'))
   172         msg = mail.mimetextpatch(body, display=opts.get('test'))
   173 
   173 
   174     subj = desc[0].strip().rstrip('. ')
   174     subj = desc[0].strip().rstrip('. ')
   175     if total == 1:
   175     if total == 1 and not opts.get('intro'):
   176         subj = '[PATCH] ' + (opts.get('subject') or subj)
   176         subj = '[PATCH] ' + (opts.get('subject') or subj)
   177     else:
   177     else:
   178         tlen = len(str(total))
   178         tlen = len(str(total))
   179         subj = '[PATCH %0*d of %d] %s' % (tlen, idx, total, subj)
   179         subj = '[PATCH %0*d of %d] %s' % (tlen, idx, total, subj)
   180     msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test'))
   180     msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test'))
   314                 name = patchnames[i]
   314                 name = patchnames[i]
   315             msg = makepatch(ui, repo, p, opts, _charsets, i + 1,
   315             msg = makepatch(ui, repo, p, opts, _charsets, i + 1,
   316                             len(patches), name)
   316                             len(patches), name)
   317             msgs.append(msg)
   317             msgs.append(msg)
   318 
   318 
   319         if len(patches) > 1:
   319         if len(patches) > 1 or opts.get('intro'):
   320             tlen = len(str(len(patches)))
   320             tlen = len(str(len(patches)))
   321 
   321 
   322             subj = '[PATCH %0*d of %d] %s' % (
   322             subj = '[PATCH %0*d of %d] %s' % (
   323                 tlen, 0, len(patches),
   323                 tlen, 0, len(patches),
   324                 opts.get('subject') or
   324                 opts.get('subject') or
   479           ('r', 'rev', [], _('a revision to send')),
   479           ('r', 'rev', [], _('a revision to send')),
   480           ('', 'force', None,
   480           ('', 'force', None,
   481            _('run even when remote repository is unrelated (with -b)')),
   481            _('run even when remote repository is unrelated (with -b)')),
   482           ('', 'base', [],
   482           ('', 'base', [],
   483            _('a base changeset to specify instead of a destination (with -b)')),
   483            _('a base changeset to specify instead of a destination (with -b)')),
       
   484           ('', 'intro', None,
       
   485            _('send an introduction email for a single patch')),
   484          ] + emailopts + commands.remoteopts,
   486          ] + emailopts + commands.remoteopts,
   485          _('hg email [OPTION]... [DEST]...'))
   487          _('hg email [OPTION]... [DEST]...'))
   486 }
   488 }