##// 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 180 jumbo.extend(p)
181 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 183 sender = (opts['from'] or ui.config('patchbomb', 'from') or
186 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 186 def getaddrs(opt, prpt, default = None):
195 187 addrs = opts[opt] or (ui.config('patchbomb', opt) or
196 188 prompt(prpt, default = default)).split(',')
@@ -198,26 +190,35 b' def patchbomb(ui, repo, *revs, **opts):'
198 190 to = getaddrs('to', 'To')
199 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 try: l = raw_input()
207 except EOFError: break
208 if l == '.': break
209 body.append(l)
206 while True:
207 try: l = raw_input()
208 except EOFError: break
209 if l == '.': break
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 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 222 if not opts['test'] and not opts['mbox']:
222 223 s = smtplib.SMTP()
223 224 s.connect(host = ui.config('smtp', 'host', 'mail'),
General Comments 0
You need to be logged in to leave comments. Login now