[MERGE] Clean up Branch.sprout

Aaron Bentley aaron at aaronbentley.com
Thu Aug 28 22:45:00 BST 2008


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

John Arbash Meinel wrote:
> At various points we register *instances* of format objects, rather than their
> classes. Which would indicate (to me) that they are singletons.

The registry for formats is format_registry, and we register *classes*
or *class names*, not instances:

format_registry.register('weave', BzrDirFormat6,
    'Pre-0.8 format.  Slower than knit and does not'
    ' support checkouts or shared repositories.',
    deprecated=True)

format_registry.register_metadir('knit',
    'bzrlib.repofmt.knitrepo.RepositoryFormatKnit1',
    'Format using knits.  Recommended for interoperation with bzr <= 0.14.',
    branch_format='bzrlib.branch.BzrBranchFormat5',
    tree_format='bzrlib.workingtree.WorkingTreeFormat3')

> Since doing:
> 
> registry.get().__class__()
> 
> Is certainly never going to be a *recommended* api.

The recommended API is format_registry.make_metadir(), not any form of get.

>> 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.
> 
> If it is used elsewhere in this fashion (especially in this function) then
> continue to use __class__(). I just find it strange.

Too late.  And actually, both approaches are exhibited in that function.

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

iD8DBQFItxxc0F+nu1YWqI0RAj2IAJ90p36/++9GvXCCIBnPAKy7j7hxWwCfV9Ra
G1uLMCG+J2fF923wMSVUQ3k=
=g6Ck
-----END PGP SIGNATURE-----



More information about the bazaar mailing list