diff hgext/transplant.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 2a8939e25d07
children 365a78daf735
line wrap: on
line diff
--- a/hgext/transplant.py	Thu May 03 18:39:58 2018 +0900
+++ b/hgext/transplant.py	Sat May 26 12:14:04 2018 +0900
@@ -16,7 +16,7 @@
 from __future__ import absolute_import
 
 import os
-import tempfile
+
 from mercurial.i18n import _
 from mercurial import (
     bundlerepo,
@@ -215,7 +215,7 @@
                 if skipmerge:
                     patchfile = None
                 else:
-                    fd, patchfile = tempfile.mkstemp(prefix='hg-transplant-')
+                    fd, patchfile = pycompat.mkstemp(prefix='hg-transplant-')
                     fp = os.fdopen(fd, r'wb')
                     gen = patch.diff(source, parent, node, opts=diffopts)
                     for chunk in gen:
@@ -263,7 +263,7 @@
 
         self.ui.status(_('filtering %s\n') % patchfile)
         user, date, msg = (changelog[1], changelog[2], changelog[4])
-        fd, headerfile = tempfile.mkstemp(prefix='hg-transplant-')
+        fd, headerfile = pycompat.mkstemp(prefix='hg-transplant-')
         fp = os.fdopen(fd, r'wb')
         fp.write("# HG changeset patch\n")
         fp.write("# User %s\n" % user)