[MERGE] Clean up Branch.sprout

Aaron Bentley aaron at aaronbentley.com
Thu Aug 28 21:26:56 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Arbash Meinel wrote:
> Aaron Bentley wrote:
>> In the process of fixing this, I also had to fix BzrDir5/6 so that
>> BzrDir.create_branch actually ran BranchFormat.initialize.  I don't know
>> why it wasn't doing that.
> 
> If I was guessing, it was because they were all-in-one formats, and so the
> branch was already created just by creating the BzrDir. Not 100% sure, though.

Yeah, but this code is also creating the BzrDir, so it would have
initted the branch, too.

>                  branch = self.open_branch()
>                  source_repository = branch.repository
> +                result_format._branch_format = branch._format.__class__()
> 
> ^- Is there a problem with doing:
> result_format._branch_format = branch._format
> 
> It seems a bit more obvious, and I thought the Format objects were meant to be
> (mostly) singletons anyway. (We are a bit inconsistent about this, IIRC.)

I don't think we're suggesting that these are singletons anywhere.  It's
just that their instances don't really have state.  (Metadirs formats do
have state, though.)

I was following the pattern used elsewhere (including this function),
but I don't think there's any practical harm in changing this.  I'll do
that, so we don't have to back-and-forth on this.

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

iD8DBQFItwoQ0F+nu1YWqI0RApF5AJ0cOgkYZu45Z+bpAo9b00rvc9tF+ACeKE35
LootLQ00fVMrGmX91LZxyJc=
=0d83
-----END PGP SIGNATURE-----



More information about the bazaar mailing list