make_branch_and_tree support for workingtree-less control directories

Jelmer Vernooij jelmer at samba.org
Sat Aug 27 14:44:06 UTC 2011


TestCaseWithTransport.make_branch_and_tree() creates, unsurprisingly, 
both a branch and a tree - in the same location.

This breaks for some control dir formats that don't support working 
trees. Good examples of this are remote bzr directories, svn repository 
directories and git bare repositories.

At the moment there are some workarounds in make_branch_and_tree to 
support treeless control directories, which are specific to 
RemoteBzrDir. I would like to make make_branch_and_tree() construct a 
branch in a different location and then create a checkout of it in the 
specified path. This should also remove the need for special casing of 
RemoteBzrDir in make_branch_and_tree.

See the attached diff for what I have in mind. With this patch, a lot 
more bzr.dev tests pass against bzr-svn (~200) and bzr-git (~150), 
leaving just a couple of handful failing in total for bzr-svn. The patch 
also introduces ~80 failing tests in bzr.dev itself, but all of those 
look like they're fixable.

The problem with this approach is that there are now (in some 
situations) two relevant formats - the format used by the branch, and 
the format used by the checkout.

What would be the best way to deal with this? I would like to fix this by:

  * Renaming the 'format' argument to 'branch_format'
  * Adding a 'tree_format' argument that is mutually exclusive with 
'branch_format'
  * Adding WorkingTreeFormat.get_branch_bzrdir_format_for_testing(), 
which returns the ControlDirFormat to use when testing WorkingTree-only 
control directories (like a svn checkout)

The main risk seems to be that callers can more easily test with the 
wrong format.

Does this seem like a reasonable approach?

Cheers,

Jelmer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: generic-make-branch-and-tree.diff
Type: text/x-patch
Size: 4543 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/bazaar/attachments/20110827/763b0e36/attachment.bin>


More information about the bazaar mailing list