Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/patch.py @ 38197:aac4be30e250
py3: wrap tempfile.mkstemp() to use bytes path
This patch just flips the default to use a bytes path on Python 3.
ca1cf9b3cce7 is backed out as the bundlepath should be bytes now.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 26 May 2018 12:14:04 +0900 |
parents | f3776f70985e |
children | 2ce60954b1b7 |
comparison
equal
deleted
inserted
replaced
38196:b39958d6b81b | 38197:aac4be30e250 |
---|---|
209 - p1, | 209 - p1, |
210 - p2. | 210 - p2. |
211 Any item can be missing from the dictionary. If filename is missing, | 211 Any item can be missing from the dictionary. If filename is missing, |
212 fileobj did not contain a patch. Caller must unlink filename when done.''' | 212 fileobj did not contain a patch. Caller must unlink filename when done.''' |
213 | 213 |
214 fd, tmpname = tempfile.mkstemp(prefix='hg-patch-') | 214 fd, tmpname = pycompat.mkstemp(prefix='hg-patch-') |
215 tmpfp = os.fdopen(fd, r'wb') | 215 tmpfp = os.fdopen(fd, r'wb') |
216 try: | 216 try: |
217 yield _extract(ui, fileobj, tmpname, tmpfp) | 217 yield _extract(ui, fileobj, tmpname, tmpfp) |
218 finally: | 218 finally: |
219 tmpfp.close() | 219 tmpfp.close() |
1107 added to the record list. If it does not apply cleanly, a rejects | 1107 added to the record list. If it does not apply cleanly, a rejects |
1108 file will be generated: you can use that when you try again. If | 1108 file will be generated: you can use that when you try again. If |
1109 all lines of the hunk are removed, then the edit is aborted and | 1109 all lines of the hunk are removed, then the edit is aborted and |
1110 the hunk is left unchanged. | 1110 the hunk is left unchanged. |
1111 """) | 1111 """) |
1112 (patchfd, patchfn) = tempfile.mkstemp(prefix="hg-editor-", | 1112 (patchfd, patchfn) = pycompat.mkstemp(prefix="hg-editor-", |
1113 suffix=".diff") | 1113 suffix=".diff") |
1114 ncpatchfp = None | 1114 ncpatchfp = None |
1115 try: | 1115 try: |
1116 # Write the initial patch | 1116 # Write the initial patch |
1117 f = util.nativeeolwriter(os.fdopen(patchfd, r'wb')) | 1117 f = util.nativeeolwriter(os.fdopen(patchfd, r'wb')) |