Mercurial > public > mercurial-scm > hg
comparison mercurial/bundlerepo.py @ 13382:d747774ca9da
Make sure bundlerepo doesn't leak temp files (issue2491)
Add empty repository.close() and call it in dispatch.
Remove bundlerepository.__del__(), merging it into bundlerepository.close(),
which overrides repository.close().
http://docs.python.org/reference/datamodel.html says:
"It is not guaranteed that __del__() methods are called for objects that
still exist when the interpreter exits."
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Sat, 12 Feb 2011 10:58:11 +0100 |
parents | 57d433f632b7 |
children | 7abab875e647 |
comparison
equal
deleted
inserted
replaced
13381:d073468e3c5f | 13382:d747774ca9da |
---|---|
249 def close(self): | 249 def close(self): |
250 """Close assigned bundle file immediately.""" | 250 """Close assigned bundle file immediately.""" |
251 self.bundle.close() | 251 self.bundle.close() |
252 if self.tempfile is not None: | 252 if self.tempfile is not None: |
253 os.unlink(self.tempfile) | 253 os.unlink(self.tempfile) |
254 | |
255 def __del__(self): | |
256 del self.bundle | |
257 if self.tempfile is not None: | |
258 os.unlink(self.tempfile) | |
259 if self._tempparent: | 254 if self._tempparent: |
260 shutil.rmtree(self._tempparent, True) | 255 shutil.rmtree(self._tempparent, True) |
261 | 256 |
262 def cancopy(self): | 257 def cancopy(self): |
263 return False | 258 return False |