##// END OF EJS Templates
py3: fix headencode() with display=False...
Denis Laxalde -
r44018:7d4f2e48 stable
parent child Browse files
Show More
@@ -362,13 +362,13 b' def headencode(ui, s, charsets=None, dis'
362 if not display:
362 if not display:
363 # split into words?
363 # split into words?
364 s, cs = _encode(ui, s, charsets)
364 s, cs = _encode(ui, s, charsets)
365 return str(email.header.Header(s, cs))
365 return encoding.strtolocal(email.header.Header(s, cs).encode())
366 return s
366 return s
367
367
368
368
369 def _addressencode(ui, name, addr, charsets=None):
369 def _addressencode(ui, name, addr, charsets=None):
370 assert isinstance(addr, bytes)
370 assert isinstance(addr, bytes)
371 name = headencode(ui, name, charsets)
371 name = encoding.strfromlocal(headencode(ui, name, charsets))
372 try:
372 try:
373 acc, dom = addr.split(b'@')
373 acc, dom = addr.split(b'@')
374 acc.decode('ascii')
374 acc.decode('ascii')
@@ -512,7 +512,8 b' mime encoded mbox (base64):'
512 X-Mercurial-Series-Id: <909a00e13e9d78b575ae.240@test-hostname>
512 X-Mercurial-Series-Id: <909a00e13e9d78b575ae.240@test-hostname>
513 User-Agent: Mercurial-patchbomb/* (glob)
513 User-Agent: Mercurial-patchbomb/* (glob)
514 Date: Thu, 01 Jan 1970 00:04:00 +0000
514 Date: Thu, 01 Jan 1970 00:04:00 +0000
515 From: Q <quux>
515 From: Q <quux> (no-py3 !)
516 From: =?iso-8859-1?q?Q?= <quux> (py3 !)
516 To: foo
517 To: foo
517 Cc: bar
518 Cc: bar
518
519
@@ -2397,9 +2398,12 b' test multi-address parsing:'
2397 User-Agent: Mercurial-patchbomb/* (glob)
2398 User-Agent: Mercurial-patchbomb/* (glob)
2398 Date: Tue, 01 Jan 1980 00:01:00 +0000
2399 Date: Tue, 01 Jan 1980 00:01:00 +0000
2399 From: quux
2400 From: quux
2400 To: spam <spam>, eggs, toast
2401 To: spam <spam>, eggs, toast (no-py3 !)
2401 Cc: foo, bar@example.com, "A, B <>" <a@example.com>
2402 Cc: foo, bar@example.com, "A, B <>" <a@example.com> (no-py3 !)
2402 Bcc: "Quux, A." <quux>
2403 Bcc: "Quux, A." <quux> (no-py3 !)
2404 To: =?iso-8859-1?q?spam?= <spam>, eggs, toast (py3 !)
2405 Cc: foo, bar@example.com, =?iso-8859-1?q?A=2C_B_=3C=3E?= <a@example.com> (py3 !)
2406 Bcc: =?iso-8859-1?q?Quux=2C_A=2E?= <quux> (py3 !)
2403
2407
2404 # HG changeset patch
2408 # HG changeset patch
2405 # User test
2409 # User test
General Comments 0
You need to be logged in to leave comments. Login now