##// END OF EJS Templates
Patchbomb only sends introductory message [0 of N] if there are multiple patches.
Lee Cantey -
r1845:cfe689ab default
parent child Browse files
Show More
@@ -180,17 +180,9 b' def patchbomb(ui, repo, *revs, **opts):'
180 jumbo.extend(p)
180 jumbo.extend(p)
181 msgs.append(makepatch(p, i + 1, len(patches)))
181 msgs.append(makepatch(p, i + 1, len(patches)))
182
182
183 ui.write(_('\nWrite the introductory message for the patch series.\n\n'))
184
185 sender = (opts['from'] or ui.config('patchbomb', 'from') or
183 sender = (opts['from'] or ui.config('patchbomb', 'from') or
186 prompt('From', ui.username()))
184 prompt('From', ui.username()))
187
185
188 msg = email.MIMEMultipart.MIMEMultipart()
189 msg['Subject'] = '[PATCH 0 of %d] %s' % (
190 len(patches),
191 opts['subject'] or
192 prompt('Subject:', rest = ' [PATCH 0 of %d] ' % len(patches)))
193
194 def getaddrs(opt, prpt, default = None):
186 def getaddrs(opt, prpt, default = None):
195 addrs = opts[opt] or (ui.config('patchbomb', opt) or
187 addrs = opts[opt] or (ui.config('patchbomb', opt) or
196 prompt(prpt, default = default)).split(',')
188 prompt(prpt, default = default)).split(',')
@@ -198,26 +190,35 b' def patchbomb(ui, repo, *revs, **opts):'
198 to = getaddrs('to', 'To')
190 to = getaddrs('to', 'To')
199 cc = getaddrs('cc', 'Cc', '')
191 cc = getaddrs('cc', 'Cc', '')
200
192
201 ui.write(_('Finish with ^D or a dot on a line by itself.\n\n'))
193 if len(patches) > 1:
194 ui.write(_('\nWrite the introductory message for the patch series.\n\n'))
202
195
203 body = []
196 msg = email.MIMEMultipart.MIMEMultipart()
197 msg['Subject'] = '[PATCH 0 of %d] %s' % (
198 len(patches),
199 opts['subject'] or
200 prompt('Subject:', rest = ' [PATCH 0 of %d] ' % len(patches)))
201
202 ui.write(_('Finish with ^D or a dot on a line by itself.\n\n'))
203
204 body = []
204
205
205 while True:
206 while True:
206 try: l = raw_input()
207 try: l = raw_input()
207 except EOFError: break
208 except EOFError: break
208 if l == '.': break
209 if l == '.': break
209 body.append(l)
210 body.append(l)
210
211
211 msg.attach(email.MIMEText.MIMEText('\n'.join(body) + '\n'))
212 msg.attach(email.MIMEText.MIMEText('\n'.join(body) + '\n'))
213
214 if opts['diffstat']:
215 d = cdiffstat(_('Final summary:\n'), jumbo)
216 if d: msg.attach(email.MIMEText.MIMEText(d))
217
218 msgs.insert(0, msg)
212
219
213 ui.write('\n')
220 ui.write('\n')
214
221
215 if opts['diffstat']:
216 d = cdiffstat(_('Final summary:\n'), jumbo)
217 if d: msg.attach(email.MIMEText.MIMEText(d))
218
219 msgs.insert(0, msg)
220
221 if not opts['test'] and not opts['mbox']:
222 if not opts['test'] and not opts['mbox']:
222 s = smtplib.SMTP()
223 s = smtplib.SMTP()
223 s.connect(host = ui.config('smtp', 'host', 'mail'),
224 s.connect(host = ui.config('smtp', 'host', 'mail'),
General Comments 0
You need to be logged in to leave comments. Login now