Mercurial > hg
comparison hgext/convert/subversion.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 | c560a4ea6dac |
children | 65d1d7da63d1 |
comparison
equal
deleted
inserted
replaced
38163:b39958d6b81b | 38164:aac4be30e250 |
---|---|
3 # Copyright(C) 2007 Daniel Holth et al | 3 # Copyright(C) 2007 Daniel Holth et al |
4 from __future__ import absolute_import | 4 from __future__ import absolute_import |
5 | 5 |
6 import os | 6 import os |
7 import re | 7 import re |
8 import tempfile | |
9 import xml.dom.minidom | 8 import xml.dom.minidom |
10 | 9 |
11 from mercurial.i18n import _ | 10 from mercurial.i18n import _ |
12 from mercurial import ( | 11 from mercurial import ( |
13 encoding, | 12 encoding, |
1223 # our copyfile method expects to record a copy that has | 1222 # our copyfile method expects to record a copy that has |
1224 # already occurred. Cross the semantic gap. | 1223 # already occurred. Cross the semantic gap. |
1225 wdest = self.wjoin(dest) | 1224 wdest = self.wjoin(dest) |
1226 exists = os.path.lexists(wdest) | 1225 exists = os.path.lexists(wdest) |
1227 if exists: | 1226 if exists: |
1228 fd, tempname = tempfile.mkstemp( | 1227 fd, tempname = pycompat.mkstemp( |
1229 prefix='hg-copy-', dir=os.path.dirname(wdest)) | 1228 prefix='hg-copy-', dir=os.path.dirname(wdest)) |
1230 os.close(fd) | 1229 os.close(fd) |
1231 os.unlink(tempname) | 1230 os.unlink(tempname) |
1232 os.rename(wdest, tempname) | 1231 os.rename(wdest, tempname) |
1233 try: | 1232 try: |
1311 self.delexec = [] | 1310 self.delexec = [] |
1312 if self.setexec: | 1311 if self.setexec: |
1313 self.xargs(self.setexec, 'propset', 'svn:executable', '*') | 1312 self.xargs(self.setexec, 'propset', 'svn:executable', '*') |
1314 self.setexec = [] | 1313 self.setexec = [] |
1315 | 1314 |
1316 fd, messagefile = tempfile.mkstemp(prefix='hg-convert-') | 1315 fd, messagefile = pycompat.mkstemp(prefix='hg-convert-') |
1317 fp = os.fdopen(fd, r'wb') | 1316 fp = os.fdopen(fd, r'wb') |
1318 fp.write(util.tonativeeol(commit.desc)) | 1317 fp.write(util.tonativeeol(commit.desc)) |
1319 fp.close() | 1318 fp.close() |
1320 try: | 1319 try: |
1321 output = self.run0('commit', | 1320 output = self.run0('commit', |