2
from bzrlib import commands
4
from version import version_info, __version__
8
# True if we are currently testing commands via the test suite.
11
"""Set the _testing flag to indicate we are no longer testing."""
16
class BzrToolsCommand(commands.Command):
18
def run_argv_aliases(self, argv, alias_argv=None):
19
result = check_bzrlib_version(version_info[:2])
20
if result is not None:
22
commands.Command.run_argv_aliases(self, argv, alias_argv)
25
def check_bzrlib_version(desired):
26
"""Check that bzrlib is compatible.
28
If version is < bzrtools version, assume incompatible.
29
If version == bzrtools version, assume completely compatible
30
If version == bzrtools version + 1, assume compatible, with deprecations
31
Otherwise, assume incompatible.
36
desired_plus = (desired[0], desired[1]+1)
37
bzrlib_version = bzrlib.version_info[:2]
38
if bzrlib_version == desired or (bzrlib_version == desired_plus and
39
bzrlib.version_info[3] == 'dev'):
42
from bzrlib.trace import warning
44
# get the message out any way we can
45
from warnings import warn as warning
46
if bzrlib_version < desired:
47
warning('Installed Bazaar version %s is too old to be used with'
50
bzrlib.__version__, __version__))
51
# Not using BzrNewError, because it may not exist.
54
warning('Plugin "Bzrtools" is not up to date with installed Bazaar'
56
'There should be a newer version of Bzrtools available, e.g.'
58
% (bzrlib.__version__, bzrlib_version[0], bzrlib_version[1]))
59
if bzrlib_version != desired_plus: