comparison mercurial/patch.py @ 36046:a5cf79755eff

py3: open temporary file in binary mode Otherwise things fail later when we write bytes to the handle. Differential Revision: https://phab.mercurial-scm.org/D2148
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Feb 2018 14:18:27 -0800
parents 04984f2e50ae
children eb91ffdaaece
comparison
equal deleted inserted replaced
36045:04984f2e50ae 36046:a5cf79755eff
213 br'\*\*\*[ \t].*?^---[ \t])', 213 br'\*\*\*[ \t].*?^---[ \t])',
214 re.MULTILINE | re.DOTALL) 214 re.MULTILINE | re.DOTALL)
215 215
216 data = {} 216 data = {}
217 fd, tmpname = tempfile.mkstemp(prefix='hg-patch-') 217 fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
218 tmpfp = os.fdopen(fd, pycompat.sysstr('w')) 218 tmpfp = os.fdopen(fd, pycompat.sysstr('wb'))
219 try: 219 try:
220 msg = pycompat.emailparser().parse(fileobj) 220 msg = pycompat.emailparser().parse(fileobj)
221 221
222 subject = msg['Subject'] and mail.headdecode(msg['Subject']) 222 subject = msg['Subject'] and mail.headdecode(msg['Subject'])
223 data['user'] = msg['From'] and mail.headdecode(msg['From']) 223 data['user'] = msg['From'] and mail.headdecode(msg['From'])