changeset 20981:4fdd1172d37e

bundlerepo: treat temporarily extracted bundle file via vfs
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 09 Mar 2014 01:03:28 +0900
parents 6fb4c94ae300
children 1df99f1ea28d
files mercurial/bundlerepo.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundlerepo.py	Sun Mar 09 01:03:28 2014 +0900
+++ b/mercurial/bundlerepo.py	Sun Mar 09 01:03:28 2014 +0900
@@ -204,8 +204,8 @@
         f = util.posixfile(bundlename, "rb")
         self.bundle = changegroup.readbundle(f, bundlename)
         if self.bundle.compressed():
-            fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-",
-                                            suffix=".hg10un", dir=self.path)
+            fdtemp, temp = self.vfs.mkstemp(prefix="hg-bundle-",
+                                            suffix=".hg10un")
             self.tempfile = temp
             fptemp = os.fdopen(fdtemp, 'wb')
 
@@ -219,8 +219,8 @@
             finally:
                 fptemp.close()
 
-            f = util.posixfile(self.tempfile, "rb")
-            self.bundle = changegroup.readbundle(f, bundlename)
+            f = self.vfs.open(self.tempfile, mode="rb")
+            self.bundle = changegroup.readbundle(f, bundlename, self.vfs)
 
         # dict with the mapping 'filename' -> position in the bundle
         self.bundlefilespos = {}
@@ -280,7 +280,7 @@
         """Close assigned bundle file immediately."""
         self.bundle.close()
         if self.tempfile is not None:
-            os.unlink(self.tempfile)
+            self.vfs.unlink(self.tempfile)
         if self._tempparent:
             shutil.rmtree(self._tempparent, True)