[MERGE] Support for lazy registation of commands

Lukáš Lalinský lalinsky at gmail.com
Sat Aug 23 15:24:34 BST 2008


Hi,

how that QBzr is included by default in the Windows installer, I wanted
to reduce the import overhead to minimum, so I wrote a function for lazy
registration of commands. But the code was so simple that I decided to
port it to bzrlib as well and submit a patch, as it might be useful for
other plugins.

register_lazy_function takes the module and class names, and will import
them only when necessary. It also takes the list of aliases for this
command, because we can't loop this up without importing the command
class.

If this patch will be accepted, I think it would make sense to split
bzrlib.builtins and lazily register all the commands instead of
importing the whole module on startup.

Lukas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: register_command_lazy-3645.patch
Type: text/x-patch
Size: 7979 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080823/b0feabfd/attachment-0001.bin 


More information about the bazaar mailing list