[BUG][MERGE] 'bzr upgrade' broken by lazy imports

John Arbash Meinel john at arbash-meinel.com
Tue Nov 7 18:18:45 GMT 2006

Howdy all, someone else managed to track down a missing import dependency:

I fixed this specific dependency with the attached patch. I'd like to
get it merged quickly. Also, we need to decide if it is worth releasing
an 0.12.1. It is a regression, though the simple workaround is to just
install bzrtools (which imports bzrlib.workingtree as part of it's startup).

I chose to fix this by doing 'from bzrlib.workingtree import Foo' rather
than changing the global imports, because that is how all the other
local functions work. And probably that is because of an import
dependency issue. One nice thing about lazy imports is that they solve
some import order issues, since you won't import something until it is used.

I'll go ahead and spend some time auditing our code base, trying to
avoid these things in the future. I'd like to get more lazy importing
(and future Registry based importing of some of the different format
classes we have). So it will be good to track through these things.

My initial feeling is to just change most code paths that use
'bzrilb.foo' to being 'from bzrlib import foo' at the beginning, and use
'foo.bar' later on.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bzrdir_import_workingtree.patch
Type: text/x-patch
Size: 1978 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061107/daf94e0e/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061107/daf94e0e/attachment.pgp 

More information about the bazaar mailing list