Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/patchbomb.py @ 4029:9210fba03d16
merge with -stable
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Mon, 15 Jan 2007 18:23:21 +0100 |
parents | 2601ac9c54f0 ba45041827a2 |
children | 03e9c22a6489 |
comparison
equal
deleted
inserted
replaced
4028:540d1059c802 | 4029:9210fba03d16 |
---|---|
61 # | 61 # |
62 # % formail -s sendmail -bm -t < mbox | 62 # % formail -s sendmail -bm -t < mbox |
63 # | 63 # |
64 # That should be all. Now your patchbomb is on its way out. | 64 # That should be all. Now your patchbomb is on its way out. |
65 | 65 |
66 from mercurial.demandload import * | 66 import os, errno, socket |
67 demandload(globals(), '''email.MIMEMultipart email.MIMEText email.Utils | 67 import email.MIMEMultipart, email.MIMEText, email.Utils |
68 mercurial:cmdutil,commands,hg,mail,ui,patch,util | 68 from mercurial import cmdutil, commands, hg, mail, ui, patch, util |
69 os errno popen2 socket sys tempfile''') | 69 from mercurial.i18n import _ |
70 from mercurial.i18n import gettext as _ | |
71 from mercurial.node import * | 70 from mercurial.node import * |
72 | 71 |
73 try: | 72 try: |
74 # readline gives raw_input editing capabilities, but is not | 73 # readline gives raw_input editing capabilities, but is not |
75 # present on windows | 74 # present on windows |
214 bcc = opts['bcc'] or (ui.config('email', 'bcc') or | 213 bcc = opts['bcc'] or (ui.config('email', 'bcc') or |
215 ui.config('patchbomb', 'bcc') or '').split(',') | 214 ui.config('patchbomb', 'bcc') or '').split(',') |
216 bcc = [a.strip() for a in bcc if a.strip()] | 215 bcc = [a.strip() for a in bcc if a.strip()] |
217 | 216 |
218 if len(patches) > 1: | 217 if len(patches) > 1: |
219 ui.write(_('\nWrite the introductory message for the patch series.\n\n')) | |
220 | |
221 tlen = len(str(len(patches))) | 218 tlen = len(str(len(patches))) |
222 | 219 |
223 subj = '[PATCH %0*d of %d] %s' % ( | 220 subj = '[PATCH %0*d of %d] %s' % ( |
224 tlen, 0, | 221 tlen, 0, |
225 len(patches), | 222 len(patches), |
226 opts['subject'] or | 223 opts['subject'] or |
227 prompt('Subject:', rest = ' [PATCH %0*d of %d] ' % (tlen, 0, | 224 prompt('Subject:', rest = ' [PATCH %0*d of %d] ' % (tlen, 0, |
228 len(patches)))) | 225 len(patches)))) |
229 | 226 |
230 ui.write(_('Finish with ^D or a dot on a line by itself.\n\n')) | 227 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']: | 228 if opts['diffstat']: |
241 d = cdiffstat(_('Final summary:\n'), jumbo) | 229 d = cdiffstat(_('Final summary:\n'), jumbo) |
242 if d: body.append('\n' + d) | 230 if d: body = '\n' + d |
243 | 231 |
244 body = '\n'.join(body) + '\n' | 232 ui.write(_('\nWrite the introductory message for the patch series.\n\n')) |
233 body = ui.edit(body, sender) | |
245 | 234 |
246 msg = email.MIMEText.MIMEText(body) | 235 msg = email.MIMEText.MIMEText(body) |
247 msg['Subject'] = subj | 236 msg['Subject'] = subj |
248 | 237 |
249 msgs.insert(0, msg) | 238 msgs.insert(0, msg) |