Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/streamclone.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 | 65b86ee69383 |
children | e59eaf51cc0d |
comparison
equal
deleted
inserted
replaced
38196:b39958d6b81b | 38197:aac4be30e250 |
---|---|
8 from __future__ import absolute_import | 8 from __future__ import absolute_import |
9 | 9 |
10 import contextlib | 10 import contextlib |
11 import os | 11 import os |
12 import struct | 12 import struct |
13 import tempfile | |
14 import warnings | 13 import warnings |
15 | 14 |
16 from .i18n import _ | 15 from .i18n import _ |
17 from . import ( | 16 from . import ( |
18 branchmap, | 17 branchmap, |
19 cacheutil, | 18 cacheutil, |
20 error, | 19 error, |
21 phases, | 20 phases, |
21 pycompat, | |
22 store, | 22 store, |
23 util, | 23 util, |
24 ) | 24 ) |
25 | 25 |
26 def canperformstreamclone(pullop, bundle2=False): | 26 def canperformstreamclone(pullop, bundle2=False): |
467 def maketempcopies(): | 467 def maketempcopies(): |
468 """return a function to temporary copy file""" | 468 """return a function to temporary copy file""" |
469 files = [] | 469 files = [] |
470 try: | 470 try: |
471 def copy(src): | 471 def copy(src): |
472 fd, dst = tempfile.mkstemp() | 472 fd, dst = pycompat.mkstemp() |
473 os.close(fd) | 473 os.close(fd) |
474 files.append(dst) | 474 files.append(dst) |
475 util.copyfiles(src, dst, hardlink=True) | 475 util.copyfiles(src, dst, hardlink=True) |
476 return dst | 476 return dst |
477 yield copy | 477 yield copy |