mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
bundlerepo: restore close() method
This commit is contained in:
parent
32de98afbd
commit
cdb9f7c881
@ -600,6 +600,7 @@ def transplant(ui, repo, *revs, **opts):
|
||||
tp.apply(repo, source, revmap, merges, opts)
|
||||
finally:
|
||||
if bundle:
|
||||
source.close()
|
||||
os.unlink(bundle)
|
||||
|
||||
cmdtable = {
|
||||
|
@ -177,7 +177,6 @@ class bundlerepository(localrepo.localrepository):
|
||||
f = open(bundlename, "rb")
|
||||
self.bundle = changegroup.readbundle(f, bundlename)
|
||||
if self.bundle.compressed():
|
||||
# we need a seekable, decompressed bundle
|
||||
fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-",
|
||||
suffix=".hg10un", dir=self.path)
|
||||
self.tempfile = temp
|
||||
@ -247,6 +246,10 @@ class bundlerepository(localrepo.localrepository):
|
||||
else:
|
||||
return filelog.filelog(self.sopener, f)
|
||||
|
||||
def close(self):
|
||||
"""Close assigned bundle file immediately."""
|
||||
self.bundle.close()
|
||||
|
||||
def __del__(self):
|
||||
del self.bundle
|
||||
if tempfile is not None:
|
||||
|
@ -143,6 +143,8 @@ class unbundle10(object):
|
||||
return self._stream.seek(pos)
|
||||
def tell(self):
|
||||
return self._stream.tell()
|
||||
def close(self):
|
||||
return self._stream.close()
|
||||
|
||||
def chunklength(self):
|
||||
d = self.read(4)
|
||||
|
Loading…
Reference in New Issue
Block a user