Rather outdated comment

Martin Pool mbp at sourcefrog.net
Fri Jul 24 21:26:12 BST 2009


2009/7/25 John Arbash Meinel <john at arbash-meinel.com>:
> I would guess that the string was originally:
>  "deprecated in version 0.10" or something similar.
>
> Certainly the comment can be removed. I'd like to remove the deprecation, but
> since we have to run __init__ still, I don't think we can.


    def __init__(self, spec, _internal=False):
        """Create a RevisionSpec referring to the Null revision.

        :param spec: The original spec supplied by the user
        :param _internal: Used to ensure that RevisionSpec is not being
            called directly. Only from RevisionSpec.from_string()
        """
        if not _internal:
            # XXX: Update this after 0.10 is released
            symbol_versioning.warn('Creating a RevisionSpec directly has'
                                   ' been deprecated in version 0.11. Use'
                                   ' RevisionSpec.from_string()'
                                   ' instead.',
                                   DeprecationWarning, stacklevel=2)
        self.user_spec = spec
        if self.prefix and spec.startswith(self.prefix):
            spec = spec[len(self.prefix):]
        self.spec = spec

You can just remove _internal and also the block that checks it.
However, people might still accidentally try to call the constructor
so maybe it's best to keep the _internal check and just leave the
warning there.

In general deleting deprecated code is good but changing this to an
error wouldn't make things any cleaner.



-- 
Martin <http://launchpad.net/~mbp/>



More information about the bazaar mailing list