[BUG] bzr selftest fails on windows

John A Meinel john at arbash-meinel.com
Tue May 24 23:58:28 BST 2005


It turns out that Windows doesn't let you rm a tree if there is a locked
file in it. So for ScratchBranch() you need to unlock the tree before
you issue the shutil.rmtree().

I'm guessing that since you are calling rmtree it is okay to unlock the
directory first.

I found this because 'bzr selftest' otherwise fails.

What's funny is that a lot of the errors that you get are that the file
doesn't exist while it is trying to traverse the tree.

So I don't know if somehow os.listdir() still reports the file as
existing even though it has been deleted, or what the problem is.
Whatever the cause, the attached patch fixes it.

*** modified file 'bzrlib/branch.py'
--- bzrlib/branch.py
+++ bzrlib/branch.py
@@ -745,6 +745,7 @@
         """Destroy the test branch, removing the scratch directory."""
         try:
             mutter("delete ScratchBranch %s" % self.base)
+            self.unlock()
             shutil.rmtree(self.base)
         except OSError, e:
             # Work around for shutil.rmtree failing on Windows when


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050524/186291c4/attachment.pgp 


More information about the bazaar mailing list