2
from bzrlib import commands
3
from bzrlib import option
8
class BzrToolsCommand(commands.Command):
10
def run_argv_aliases(self, argv, alias_argv=None):
11
result = check_bzrlib_version(version_info[:2])
12
if result is not None:
14
commands.Command.run_argv_aliases(self, argv, alias_argv)
17
def check_bzrlib_version(desired):
18
"""Check that bzrlib is compatible.
20
If version is < bzrtools version, assume incompatible.
21
If version == bzrtools version, assume completely compatible
22
If version == bzrtools version + 1, assume compatible, with deprecations
23
Otherwise, assume incompatible.
25
desired_plus = (desired[0], desired[1]+1)
26
bzrlib_version = bzrlib.version_info[:2]
27
if bzrlib_version == desired or (bzrlib_version == desired_plus and
28
bzrlib.version_info[3] == 'dev'):
30
# force ImportReplacer to be evaluated
31
commands.option._verbosity_level
33
from bzrlib.trace import warning
35
# get the message out any way we can
36
from warnings import warn as warning
37
if bzrlib_version < desired:
38
warning('Installed Bazaar version %s is too old to be used with'
41
bzrlib.__version__, '%s.%s.%s' % version_info))
42
# Not using BzrNewError, because it may not exist.
45
warning('Plugin "Bzrtools" is not up to date with installed Bazaar'
47
'There should be a newer version of Bzrtools available, e.g.'
49
% (bzrlib.__version__, bzrlib_version[0], bzrlib_version[1]))
50
if bzrlib_version != desired_plus: