Show More
@@ -12,7 +12,6 b' import collections' | |||
|
12 | 12 | import copy |
|
13 | 13 | import difflib |
|
14 | 14 | import email |
|
15 | import email.parser as emailparser | |
|
16 | 15 | import errno |
|
17 | 16 | import hashlib |
|
18 | 17 | import os |
@@ -109,7 +108,7 b' def split(stream):' | |||
|
109 | 108 | cur.append(line) |
|
110 | 109 | c = chunk(cur) |
|
111 | 110 | |
|
112 |
m = emailparser |
|
|
111 | m = pycompat.emailparser().parse(c) | |
|
113 | 112 | if not m.is_multipart(): |
|
114 | 113 | yield msgfp(m) |
|
115 | 114 | else: |
@@ -218,7 +217,7 b' def extract(ui, fileobj):' | |||
|
218 | 217 | fd, tmpname = tempfile.mkstemp(prefix='hg-patch-') |
|
219 | 218 | tmpfp = os.fdopen(fd, pycompat.sysstr('w')) |
|
220 | 219 | try: |
|
221 |
msg = emailparser |
|
|
220 | msg = pycompat.emailparser().parse(fileobj) | |
|
222 | 221 | |
|
223 | 222 | subject = msg['Subject'] and mail.headdecode(msg['Subject']) |
|
224 | 223 | data['user'] = msg['From'] and mail.headdecode(msg['From']) |
@@ -267,6 +267,10 b' if ispy3:' | |||
|
267 | 267 | ret = shlex.split(s.decode('latin-1')) |
|
268 | 268 | return [a.encode('latin-1') for a in ret] |
|
269 | 269 | |
|
270 | def emailparser(*args, **kwargs): | |
|
271 | import email.parser | |
|
272 | return email.parser.BytesParser(*args, **kwargs) | |
|
273 | ||
|
270 | 274 | else: |
|
271 | 275 | import cStringIO |
|
272 | 276 | |
@@ -327,6 +331,10 b' else:' | |||
|
327 | 331 | ziplist = zip |
|
328 | 332 | rawinput = raw_input |
|
329 | 333 | |
|
334 | def emailparser(*args, **kwargs): | |
|
335 | import email.parser | |
|
336 | return email.parser.Parser(*args, **kwargs) | |
|
337 | ||
|
330 | 338 | isjython = sysplatform.startswith('java') |
|
331 | 339 | |
|
332 | 340 | isdarwin = sysplatform == 'darwin' |
General Comments 0
You need to be logged in to leave comments.
Login now