[Pkg-bazaar-commits] ./bzr/unstable r396: - Using the destructor on a ScratchBranch is not reliable;
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 07:43:40 UTC 2009
------------------------------------------------------------
revno: 396
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Mon 2005-05-09 09:19:40 +1000
message:
- Using the destructor on a ScratchBranch is not reliable;
so now there's a destroy() method as well.
modified:
bzrlib/branch.py
-------------- next part --------------
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2005-05-05 23:28:03 +0000
+++ b/bzrlib/branch.py 2005-05-08 23:19:40 +0000
@@ -967,7 +967,7 @@
>>> isdir(b.base)
True
>>> bd = b.base
- >>> del b
+ >>> b.destroy()
>>> isdir(bd)
False
"""
@@ -987,16 +987,22 @@
def __del__(self):
+ self.destroy()
+
+ def destroy(self):
"""Destroy the test branch, removing the scratch directory."""
try:
+ mutter("delete ScratchBranch %s" % self.base)
shutil.rmtree(self.base)
- except OSError:
+ except OSError, e:
# Work around for shutil.rmtree failing on Windows when
# readonly files are encountered
+ mutter("hit exception in destroying ScratchBranch: %s" % e)
for root, dirs, files in os.walk(self.base, topdown=False):
for name in files:
os.chmod(os.path.join(root, name), 0700)
shutil.rmtree(self.base)
+ self.base = None
More information about the Pkg-bazaar-commits
mailing list