diff mercurial/upgrade.py @ 38198:2ce60954b1b7

py3: wrap tempfile.mkdtemp() to use bytes path This also flips the default to use a bytes path on Python 3.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 26 May 2018 12:20:36 +0900
parents c8666a9e9e11
children f273b768b60f
line wrap: on
line diff
--- a/mercurial/upgrade.py	Sat May 26 12:14:04 2018 +0900
+++ b/mercurial/upgrade.py	Sat May 26 12:20:36 2018 +0900
@@ -8,7 +8,6 @@
 from __future__ import absolute_import
 
 import stat
-import tempfile
 
 from .i18n import _
 from . import (
@@ -18,6 +17,7 @@
     hg,
     localrepo,
     manifest,
+    pycompat,
     revlog,
     scmutil,
     util,
@@ -657,7 +657,7 @@
 
     ui.write(_('data fully migrated to temporary repository\n'))
 
-    backuppath = tempfile.mkdtemp(prefix='upgradebackup.', dir=srcrepo.path)
+    backuppath = pycompat.mkdtemp(prefix='upgradebackup.', dir=srcrepo.path)
     backupvfs = vfsmod.vfs(backuppath)
 
     # Make a backup of requires file first, as it is the first to be modified.
@@ -842,7 +842,7 @@
         # data. There are less heavyweight ways to do this, but it is easier
         # to create a new repo object than to instantiate all the components
         # (like the store) separately.
-        tmppath = tempfile.mkdtemp(prefix='upgrade.', dir=repo.path)
+        tmppath = pycompat.mkdtemp(prefix='upgrade.', dir=repo.path)
         backuppath = None
         try:
             ui.write(_('creating temporary repository to stage migrated '