[MERGE][0.12] Avoid circular import for bzrlib.tree and bzrlib.revisiontree

Martin Pool mbp at canonical.com
Wed Oct 18 09:25:50 BST 2006


On 16 Oct 2006, John Arbash Meinel <john at arbash-meinel.com> wrote:
> The attached patch fixes bug:
> https://launchpad.net/products/bzr/+bug/63660
> 
> RevisionTree was moved out of bzrlib.tree into bzrlib.revisiontree a
> while ago, but for compatibility it was imported back into bzrlib.tree.
> This caused a circular import between the two, so if
> 'bzrlib.revisiontree' got imported before 'bzrlib.tree' it would fail.
> The new lazy_import code triggered other bugs, because we no longer
> import things in the same order. (bug 66349).

+1 for 0.12

> +
> +
> +# This was deprecated before 0.12, but did not have an official warning
> + at symbol_versioning.deprecated_function(symbol_versioning.zero_twelve)
> +def RevisionTree(*args, **kwargs):
> +    """RevisionTree has moved to bzrlib.revisiontree.RevisionTree()
> +
> +    Accessing it as bzrlib.tree.RevisionTree has been deprecated as of
> +    bzr 0.12.
> +    """
> +    from bzrlib.revisiontree import RevisionTree as _RevisionTree
> +    return _RevisionTree(*args, **kwargs)
> + 
> +

Obviously this won't catch people who do isinstance, but at least it's a
clue that it's deprecated.

-- 
Martin




More information about the bazaar mailing list