Mercurial > hg
changeset 12347:6277a9469dff
bundlerepo: restore close() method
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 20 Sep 2010 16:14:05 -0500 |
parents | 3b165c127690 |
children | 7f97b4841ee7 |
files | hgext/transplant.py mercurial/bundlerepo.py mercurial/changegroup.py |
diffstat | 3 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/transplant.py Mon Sep 20 16:00:15 2010 -0500 +++ b/hgext/transplant.py Mon Sep 20 16:14:05 2010 -0500 @@ -600,6 +600,7 @@ tp.apply(repo, source, revmap, merges, opts) finally: if bundle: + source.close() os.unlink(bundle) cmdtable = {
--- a/mercurial/bundlerepo.py Mon Sep 20 16:00:15 2010 -0500 +++ b/mercurial/bundlerepo.py Mon Sep 20 16:14:05 2010 -0500 @@ -177,7 +177,6 @@ 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 @@ 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:
--- a/mercurial/changegroup.py Mon Sep 20 16:00:15 2010 -0500 +++ b/mercurial/changegroup.py Mon Sep 20 16:14:05 2010 -0500 @@ -143,6 +143,8 @@ 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)