2
from bzrlib import commands
7
class BzrToolsCommand(commands.Command):
9
def run_argv_aliases(self, argv, alias_argv=None):
10
result = check_bzrlib_version(version_info[:2])
11
if result is not None:
13
commands.Command.run_argv_aliases(self, argv, alias_argv)
16
def check_bzrlib_version(desired):
17
"""Check that bzrlib is compatible.
19
If version is < bzrtools version, assume incompatible.
20
If version == bzrtools version, assume completely compatible
21
If version == bzrtools version + 1, assume compatible, with deprecations
22
Otherwise, assume incompatible.
24
desired_plus = (desired[0], desired[1]+1)
25
bzrlib_version = bzrlib.version_info[:2]
26
if bzrlib_version == desired or (bzrlib_version == desired_plus and
27
bzrlib.version_info[3] == 'dev'):
30
from bzrlib.trace import warning
32
# get the message out any way we can
33
from warnings import warn as warning
34
if bzrlib_version < desired:
35
warning('Installed Bazaar version %s is too old to be used with'
38
bzrlib.__version__, '%s.%s.%s' % version_info))
39
# Not using BzrNewError, because it may not exist.
42
warning('Plugin "Bzrtools" is not up to date with installed Bazaar'
44
'There should be a newer version of Bzrtools available, e.g.'
46
% (bzrlib.__version__, bzrlib_version[0], bzrlib_version[1]))
47
if bzrlib_version != desired_plus: