Show More
@@ -49,20 +49,11 b'' | |||||
49 | # to = recipient1, recipient2, ... |
|
49 | # to = recipient1, recipient2, ... | |
50 | # cc = cc1, cc2, ... |
|
50 | # cc = cc1, cc2, ... | |
51 |
|
51 | |||
52 | from email.MIMEMultipart import MIMEMultipart |
|
52 | from mercurial.demandload import * | |
53 | from email.MIMEText import MIMEText |
|
53 | demandload(globals(), '''email.MIMEMultipart email.MIMEText email.Utils | |
54 | from email.Utils import parseaddr |
|
54 | mercurial:commands,hg,ui | |
55 | from mercurial import commands |
|
55 | os popen2 smtplib socket sys tempfile time''') | |
56 | from mercurial import hg |
|
|||
57 | from mercurial import ui |
|
|||
58 | from mercurial.i18n import gettext as _ |
|
56 | from mercurial.i18n import gettext as _ | |
59 | import os |
|
|||
60 | import popen2 |
|
|||
61 | import smtplib |
|
|||
62 | import socket |
|
|||
63 | import sys |
|
|||
64 | import tempfile |
|
|||
65 | import time |
|
|||
66 |
|
57 | |||
67 | try: |
|
58 | try: | |
68 | # readline gives raw_input editing capabilities, but is not |
|
59 | # readline gives raw_input editing capabilities, but is not | |
@@ -149,7 +140,7 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
149 | if opts['diffstat']: |
|
140 | if opts['diffstat']: | |
150 | body += cdiffstat('\n'.join(desc), patch) + '\n\n' |
|
141 | body += cdiffstat('\n'.join(desc), patch) + '\n\n' | |
151 | body += '\n'.join(patch) |
|
142 | body += '\n'.join(patch) | |
152 | msg = MIMEText(body) |
|
143 | msg = email.MIMEText.MIMEText(body) | |
153 | subj = '[PATCH %d of %d] %s' % (idx, total, desc[0].strip()) |
|
144 | subj = '[PATCH %d of %d] %s' % (idx, total, desc[0].strip()) | |
154 | if subj.endswith('.'): subj = subj[:-1] |
|
145 | if subj.endswith('.'): subj = subj[:-1] | |
155 | msg['Subject'] = subj |
|
146 | msg['Subject'] = subj | |
@@ -194,7 +185,7 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
194 | sender = (opts['from'] or ui.config('patchbomb', 'from') or |
|
185 | sender = (opts['from'] or ui.config('patchbomb', 'from') or | |
195 | prompt('From', ui.username())) |
|
186 | prompt('From', ui.username())) | |
196 |
|
187 | |||
197 | msg = MIMEMultipart() |
|
188 | msg = email.MIMEMultipart.MIMEMultipart() | |
198 | msg['Subject'] = '[PATCH 0 of %d] %s' % ( |
|
189 | msg['Subject'] = '[PATCH 0 of %d] %s' % ( | |
199 | len(patches), |
|
190 | len(patches), | |
200 | opts['subject'] or |
|
191 | opts['subject'] or | |
@@ -217,13 +208,13 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
217 | if l == '.': break |
|
208 | if l == '.': break | |
218 | body.append(l) |
|
209 | body.append(l) | |
219 |
|
210 | |||
220 | msg.attach(MIMEText('\n'.join(body) + '\n')) |
|
211 | msg.attach(email.MIMEText.MIMEText('\n'.join(body) + '\n')) | |
221 |
|
212 | |||
222 | ui.write('\n') |
|
213 | ui.write('\n') | |
223 |
|
214 | |||
224 | if opts['diffstat']: |
|
215 | if opts['diffstat']: | |
225 | d = cdiffstat(_('Final summary:\n'), jumbo) |
|
216 | d = cdiffstat(_('Final summary:\n'), jumbo) | |
226 | if d: msg.attach(MIMEText(d)) |
|
217 | if d: msg.attach(email.MIMEText.MIMEText(d)) | |
227 |
|
218 | |||
228 | msgs.insert(0, msg) |
|
219 | msgs.insert(0, msg) | |
229 |
|
220 | |||
@@ -241,7 +232,7 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
241 | s.login(username, password) |
|
232 | s.login(username, password) | |
242 | parent = None |
|
233 | parent = None | |
243 | tz = time.strftime('%z') |
|
234 | tz = time.strftime('%z') | |
244 | sender_addr = parseaddr(sender)[1] |
|
235 | sender_addr = email.Utils.parseaddr(sender)[1] | |
245 | for m in msgs: |
|
236 | for m in msgs: | |
246 | try: |
|
237 | try: | |
247 | m['Message-Id'] = genmsgid(m['X-Mercurial-Node']) |
|
238 | m['Message-Id'] = genmsgid(m['X-Mercurial-Node']) |
General Comments 0
You need to be logged in to leave comments.
Login now