bzrlib.bzrdir.format_registry.set_default() cannot be called twice

John Arbash Meinel john at arbash-meinel.com
Tue May 8 20:55:31 BST 2007


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

We currently use format_registry.set_default(name) to define what branch
format should be the default.

Someone asked on IRC how to switch the default to dirstate-tags, so my
first thought was to do this in a plugin:

import bzrlib.bzrdir

bzrlib.bzrdir.format_registry.set_default('dirstate-tags')


That failed because it is actually registering the format "default", and
that format has already been registered.

The workaround is to add

bzrlib.bzrdir.format_registry.remove('default')

before the set_default() call.

To me, it seems more reasonable to either:

1) have 'set_default' check if default is already registered and remove it.
2) Have 'set_default' use the default logic that Registry already has.
(you can use registry.get(None) to get the default object, rather than
using a key like 'default').
This would mean you don't have 'default' registered


 affects /products/bzr
 importance low
 status confirmed
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGQNWyJdeBCYSNAAMRAoLgAKCThr/UmmAuUWO+pztZUS+To7EtjQCfcECx
MTZOGHERySmK27bABkOVy3U=
=kD6H
-----END PGP SIGNATURE-----



More information about the bazaar mailing list