diff -r ad5b61370514 -r 6fb4c94ae300 mercurial/scmutil.py --- a/mercurial/scmutil.py Sun Mar 09 01:03:28 2014 +0900 +++ b/mercurial/scmutil.py Sun Mar 09 01:03:28 2014 +0900 @@ -10,7 +10,7 @@ import util, error, osutil, revset, similar, encoding, phases, parsers import pathutil import match as matchmod -import os, errno, re, glob +import os, errno, re, glob, tempfile if os.name == 'nt': import scmwindows as scmplatform @@ -193,6 +193,15 @@ def mkdir(self, path=None): return os.mkdir(self.join(path)) + def mkstemp(self, suffix='', prefix='tmp', dir=None, text=False): + fd, name = tempfile.mkstemp(suffix=suffix, prefix=prefix, + dir=self.join(dir), text=text) + dname, fname = util.split(name) + if dir: + return fd, os.path.join(dir, fname) + else: + return fd, fname + def readdir(self, path=None, stat=None, skip=None): return osutil.listdir(self.join(path), stat, skip)