Mercurial > hg > mercurial-crew-with-dirclash
changeset 3419:b19360aa21e9
bundlerepo: avoid exception in __del__ when the bundle doesn't exist
$ hg -R bundle://foo.hg
abort: No such file or directory: foo.hg
Exception exceptions.AttributeError: "'bundlerepository' object has no attribute 'bundlefile'" in <bound method bundlerepository.__del__ of <mercurial.bundlerepo.bundlerepository object at 0xa7ab9fac>> ignored
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Mon, 16 Oct 2006 20:38:04 -0300 |
parents | 7012c889e8f2 |
children | 594d1ff79609 |
files | mercurial/bundlerepo.py tests/test-bundle tests/test-bundle.out |
diffstat | 3 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -233,10 +233,12 @@ class bundlerepository(localrepo.localre self.bundlefile.close() def __del__(self): - if not self.bundlefile.closed: - self.bundlefile.close() - if self.tempfile is not None: - os.unlink(self.tempfile) + bundlefile = getattr(self, 'bundlefile', None) + if bundlefile and not bundlefile.closed: + bundlefile.close() + tempfile = getattr(self, 'tempfile', None) + if tempfile is not None: + os.unlink(tempfile) def instance(ui, path, create): if create: