[MERGE] Policy-based repository acquisition

Aaron Bentley aaron at aaronbentley.com
Wed Apr 9 22:14:40 BST 2008

Hash: SHA1

Andrew Bennetts wrote:
>>> I don't think the intent of this test is entirely self-evident, either.  How
>>> about adding a docstring like: "A bzrdir will by default use itself when
>>> acquiring a repository (creating one if necessary.)"  Did I guess right?
>> The bit about creating one if necessary is wrong-- it always creates it.
> Just goes to show that the intent wasn't self-evident, then :)
>>>> +    def test_clone_on_transport_preserves_repo_format(self):
>>>> +        source_branch = self.make_branch('source', format='knit')
>>>> +        # Ensure no format data is cached
>>>> +        a_dir = bzrlib.branch.Branch.open_from_transport(
>>>> +            self.get_transport('source')).bzrdir
>>>> +        target_transport = a_dir.root_transport.clone('..').clone('target')
>>>> +        target_bzrdir = a_dir.clone_on_transport(target_transport)
>>>> +        target_repo = target_bzrdir.open_repository()
>>>> +        self.assertEqual(target_repo._format, source_branch.repository._format)
>>> I think this probably ought to be a bzrdir_implementations test
>> No.  I tried it and it just didn't work properly.  It seemed like the
>> test infrastructure was interfering with creating a knit repo.
> That's a shame.  The test infrastructure is there to help rather than hinder.
> We should figure out how to improve this part of the test infrastructure at some
> point...

Okay, I've tweaked TestCaseWithBzrDir.make_bzrdir so that it only
overrides the default format, not user-supplied formats.

I've tried to apply your changes, but there was enough new work that I
thought a re-review was prudent, rather than just merging.

Especially, you'll see I had to do isinstance(result, RemoteBzrDir) to
suppress the set_make_working_trees, which RemoteRepository deliberately
leaves unimplemented.

It also falsifies the value of get_make_workingtrees, and neither seems
to be necessary.  When you clone on any other transport,
make_working_trees is preserved, and I don't see a need to vary this on
the smart protocol.  Sure, it doesn't mean that trees will be created on
push, but that's not what the flag controls.  It controls local
operations.  And just because a repository was created over the smart
server doesn't mean that it will never be accessed locally.

Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: stacking-policy2.patch
Type: text/x-diff
Size: 26561 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080409/7ea1f328/attachment-0001.bin 

More information about the bazaar mailing list