changeset 24072:145b823f5ce7

bundlerepo: keep track of the original bundle object Bundlerepo should always close() the object that it receives from exchange.readbundle(). When bundle2 support is added in a later diff, self.bundle will be overwritten to be the changegroup part instead of the entire bundle unpacker.
author Eric Sumner <ericsumner@fb.com>
date Thu, 05 Feb 2015 16:03:26 -0800
parents 184a2f6f40da
children ff5caa8dfd99
files mercurial/bundlerepo.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundlerepo.py	Thu Feb 05 15:56:50 2015 -0800
+++ b/mercurial/bundlerepo.py	Thu Feb 05 16:03:26 2015 -0800
@@ -216,7 +216,7 @@
 
         self.tempfile = None
         f = util.posixfile(bundlename, "rb")
-        self.bundle = exchange.readbundle(ui, f, bundlename)
+        self.bundlefile = self.bundle = exchange.readbundle(ui, f, bundlename)
         if self.bundle.compressed():
             fdtemp, temp = self.vfs.mkstemp(prefix="hg-bundle-",
                                             suffix=".hg10un")
@@ -234,7 +234,9 @@
                 fptemp.close()
 
             f = self.vfs.open(self.tempfile, mode="rb")
-            self.bundle = exchange.readbundle(ui, f, bundlename, self.vfs)
+            self.bundlefile = self.bundle = exchange.readbundle(ui, f,
+                                                                bundlename,
+                                                                self.vfs)
 
         # dict with the mapping 'filename' -> position in the bundle
         self.bundlefilespos = {}
@@ -300,7 +302,7 @@
 
     def close(self):
         """Close assigned bundle file immediately."""
-        self.bundle.close()
+        self.bundlefile.close()
         if self.tempfile is not None:
             self.vfs.unlink(self.tempfile)
         if self._tempparent: