Mercurial > hg
comparison hgext/infinitepush/common.py @ 38164: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 | 5a9692d0d6fc |
children | 090e5f3900b7 |
comparison
equal
deleted
inserted
replaced
38163:b39958d6b81b | 38164:aac4be30e250 |
---|---|
4 # GNU General Public License version 2 or any later version. | 4 # GNU General Public License version 2 or any later version. |
5 | 5 |
6 from __future__ import absolute_import | 6 from __future__ import absolute_import |
7 | 7 |
8 import os | 8 import os |
9 import tempfile | |
10 | 9 |
11 from mercurial.node import hex | 10 from mercurial.node import hex |
12 | 11 |
13 from mercurial import ( | 12 from mercurial import ( |
14 error, | 13 error, |
15 extensions, | 14 extensions, |
15 pycompat, | |
16 ) | 16 ) |
17 | 17 |
18 def isremotebooksenabled(ui): | 18 def isremotebooksenabled(ui): |
19 return ('remotenames' in extensions._extensions and | 19 return ('remotenames' in extensions._extensions and |
20 ui.configbool('remotenames', 'bookmarks')) | 20 ui.configbool('remotenames', 'bookmarks')) |
28 bundleraw = store.read(bundleid) | 28 bundleraw = store.read(bundleid) |
29 return _makebundlefromraw(bundleraw) | 29 return _makebundlefromraw(bundleraw) |
30 | 30 |
31 def _makebundlefromraw(data): | 31 def _makebundlefromraw(data): |
32 fp = None | 32 fp = None |
33 fd, bundlefile = tempfile.mkstemp() | 33 fd, bundlefile = pycompat.mkstemp() |
34 try: # guards bundlefile | 34 try: # guards bundlefile |
35 try: # guards fp | 35 try: # guards fp |
36 fp = os.fdopen(fd, 'wb') | 36 fp = os.fdopen(fd, 'wb') |
37 fp.write(data) | 37 fp.write(data) |
38 finally: | 38 finally: |