##// END OF EJS Templates
get patchbomb extension to use demandload. speeds up hg startup by 50%.
Vadim Gelfer -
r1827:26dd4ae7 default
parent child Browse files
Show More
@@ -49,20 +49,11 b''
49 49 # to = recipient1, recipient2, ...
50 50 # cc = cc1, cc2, ...
51 51
52 from email.MIMEMultipart import MIMEMultipart
53 from email.MIMEText import MIMEText
54 from email.Utils import parseaddr
55 from mercurial import commands
56 from mercurial import hg
57 from mercurial import ui
52 from mercurial.demandload import *
53 demandload(globals(), '''email.MIMEMultipart email.MIMEText email.Utils
54 mercurial:commands,hg,ui
55 os popen2 smtplib socket sys tempfile time''')
58 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 58 try:
68 59 # readline gives raw_input editing capabilities, but is not
@@ -149,7 +140,7 b' def patchbomb(ui, repo, *revs, **opts):'
149 140 if opts['diffstat']:
150 141 body += cdiffstat('\n'.join(desc), patch) + '\n\n'
151 142 body += '\n'.join(patch)
152 msg = MIMEText(body)
143 msg = email.MIMEText.MIMEText(body)
153 144 subj = '[PATCH %d of %d] %s' % (idx, total, desc[0].strip())
154 145 if subj.endswith('.'): subj = subj[:-1]
155 146 msg['Subject'] = subj
@@ -194,7 +185,7 b' def patchbomb(ui, repo, *revs, **opts):'
194 185 sender = (opts['from'] or ui.config('patchbomb', 'from') or
195 186 prompt('From', ui.username()))
196 187
197 msg = MIMEMultipart()
188 msg = email.MIMEMultipart.MIMEMultipart()
198 189 msg['Subject'] = '[PATCH 0 of %d] %s' % (
199 190 len(patches),
200 191 opts['subject'] or
@@ -217,13 +208,13 b' def patchbomb(ui, repo, *revs, **opts):'
217 208 if l == '.': break
218 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 213 ui.write('\n')
223 214
224 215 if opts['diffstat']:
225 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 219 msgs.insert(0, msg)
229 220
@@ -241,7 +232,7 b' def patchbomb(ui, repo, *revs, **opts):'
241 232 s.login(username, password)
242 233 parent = None
243 234 tz = time.strftime('%z')
244 sender_addr = parseaddr(sender)[1]
235 sender_addr = email.Utils.parseaddr(sender)[1]
245 236 for m in msgs:
246 237 try:
247 238 m['Message-Id'] = genmsgid(m['X-Mercurial-Node'])
General Comments 0
You need to be logged in to leave comments. Login now