posix: tiptoe around tempfile module more delicately
Some of the values inside the tempfile calls here are str on Python 3,
so we've got to pass str in. Use fsdecode to work around the issue.
--- a/mercurial/posix.py Sun Mar 19 01:05:48 2017 -0400
+++ b/mercurial/posix.py Sun Mar 19 01:06:47 2017 -0400
@@ -230,13 +230,16 @@
else:
checkdir = path
cachedir = None
- name = tempfile.mktemp(dir=checkdir, prefix='checklink-')
+ fscheckdir = pycompat.fsdecode(checkdir)
+ name = tempfile.mktemp(dir=fscheckdir,
+ prefix=r'checklink-')
+ name = pycompat.fsencode(name)
try:
fd = None
if cachedir is None:
- fd = tempfile.NamedTemporaryFile(dir=checkdir,
- prefix='hg-checklink-')
- target = os.path.basename(fd.name)
+ fd = tempfile.NamedTemporaryFile(dir=fscheckdir,
+ prefix=r'hg-checklink-')
+ target = pycompat.fsencode(os.path.basename(fd.name))
else:
# create a fixed file to link to; doesn't matter if it
# already exists.