Show More
@@ -192,6 +192,26 b' def _getbundle(repo, dest, **opts):' | |||
|
192 | 192 | pass |
|
193 | 193 | os.rmdir(tmpdir) |
|
194 | 194 | |
|
195 | def _getdescription(repo, defaultbody, sender, **opts): | |
|
196 | """obtain the body of the introduction message and return it | |
|
197 | ||
|
198 | This is also used for the body of email with an attached bundle. | |
|
199 | ||
|
200 | The body can be obtained either from the command line option or entered by | |
|
201 | the user through the editor. | |
|
202 | """ | |
|
203 | ui = repo.ui | |
|
204 | if opts.get('desc'): | |
|
205 | body = open(opts.get('desc')).read() | |
|
206 | else: | |
|
207 | ui.write(_('\nWrite the introductory message for the ' | |
|
208 | 'patch series.\n\n')) | |
|
209 | body = ui.edit(defaultbody, sender) | |
|
210 | # Save series description in case sendmail fails | |
|
211 | msgfile = repo.opener('last-email.txt', 'wb') | |
|
212 | msgfile.write(body) | |
|
213 | msgfile.close() | |
|
214 | return body | |
|
195 | 215 | |
|
196 | 216 | emailopts = [ |
|
197 | 217 | ('', 'body', None, _('send patches as inline message text (default)')), |
@@ -368,19 +388,6 b' def patchbomb(ui, repo, *revs, **opts):' | |||
|
368 | 388 | def genmsgid(id): |
|
369 | 389 | return '<%s.%s@%s>' % (id[:20], int(start_time[0]), socket.getfqdn()) |
|
370 | 390 | |
|
371 | def getdescription(body, sender): | |
|
372 | if opts.get('desc'): | |
|
373 | body = open(opts.get('desc')).read() | |
|
374 | else: | |
|
375 | ui.write(_('\nWrite the introductory message for the ' | |
|
376 | 'patch series.\n\n')) | |
|
377 | body = ui.edit(body, sender) | |
|
378 | # Save series description in case sendmail fails | |
|
379 | msgfile = repo.opener('last-email.txt', 'wb') | |
|
380 | msgfile.write(body) | |
|
381 | msgfile.close() | |
|
382 | return body | |
|
383 | ||
|
384 | 391 | def getpatchmsgs(patches, patchnames=None): |
|
385 | 392 | msgs = [] |
|
386 | 393 | |
@@ -430,7 +437,7 b' def patchbomb(ui, repo, *revs, **opts):' | |||
|
430 | 437 | else: |
|
431 | 438 | diffstat = None |
|
432 | 439 | |
|
433 | body = getdescription(body, sender) | |
|
440 | body = _getdescription(repo, body, sender, **opts) | |
|
434 | 441 | msg = mail.mimeencode(ui, body, _charsets, opts.get('test')) |
|
435 | 442 | msg['Subject'] = mail.headencode(ui, subj, _charsets, |
|
436 | 443 | opts.get('test')) |
@@ -440,7 +447,7 b' def patchbomb(ui, repo, *revs, **opts):' | |||
|
440 | 447 | subj = (opts.get('subject') |
|
441 | 448 | or prompt(ui, 'Subject:', 'A bundle for your repository')) |
|
442 | 449 | |
|
443 | body = getdescription('', sender) | |
|
450 | body = _getdescription(repo, '', sender, **opts) | |
|
444 | 451 | msg = email.MIMEMultipart.MIMEMultipart() |
|
445 | 452 | if body: |
|
446 | 453 | msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) |
General Comments 0
You need to be logged in to leave comments.
Login now