Tree Transform passing all tests, plus abuse

John A Meinel john at arbash-meinel.com
Sat Feb 11 19:07:31 GMT 2006


Denys Duchier wrote:
> Aaron Bentley <aaron.bentley at utoronto.ca> writes:
> 
>> I've now tested it on win32, and I'm sorry to say there are a few cases
>> where we're getting bitten by the different rename behavior.  I'm going
>> to make it a conflict on *nix to create a new file without removing the
>> old one, first.
> 
> yes, such differences can otherwise lead to very puzzling behaviour. today, on
> irc, webchick repported a problem branching bzrtools.  as best as I could figure
> out (by inspection of the code, since I don't run windows), in bzr.dev
> revno=1527, the write lock is held while installing a new branch's control
> files.  Unfortunately, the write lock is on file branch-lock, and branch-lock is
> also one the control files to be installed (by _make_control).  As result, when
> bzr attempts to install control file branch-lock, the latter already exists and
> rename() fails on windows (on linux, I guess the write lock becomes meaningless
> since it is now held on a file (inode) that is no longer accessible from the
> file system).
> 
> Fortunately, revno=1528 does it in a different and (I think) correct way.
> 
> --Denys
> 

I reported this under "latest bzr.dev double locks the branch".
Basically the WorkingTree code is trying to determine when it is sharing
the same location as the branch, but it is doing so incorrectly, and
thus instantiating its own control_files. All we really need to do is
change that one line so that format 4,5 or 6 branches *always* shared
control files between the branch and the working tree, since there is no
support for anything else.

This is the patch that should fix it:

=== modified file 'bzrlib/workingtree.py'
--- bzrlib/workingtree.py
+++ bzrlib/workingtree.py
@@ -208,9 +208,8 @@
         self.basedir = realpath(basedir)
         # if branch is at our basedir and is a format 6 or less
         if (isinstance(self.branch._branch_format,
-                       (BzrBranchFormat4, BzrBranchFormat5,
BzrBranchFormat6))
+            (BzrBranchFormat4, BzrBranchFormat5, BzrBranchFormat6))):
             # might be able to share control object
-            and self.branch.base.split('/')[-2] ==
self.basedir.split('/')[-1]):
             self._control_files = self.branch.control_files
         elif _control_files is not None:
             assert False, "not done yet"

I did this basic thing in a win32-hack-around branch that I wrote for a
friend.
We would need tests to make sure we don't mess this up otherwise. But
that should at least fix the double lock issue on windows.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060211/225b9817/attachment.pgp 


More information about the bazaar mailing list