Rev 1723: Use new bzrlib.api functions. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Wed Oct 8 03:32:03 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/trunk

------------------------------------------------------------
revno: 1723
revision-id: jelmer at samba.org-20081008023159-mn6udtwarqfpyrre
parent: jelmer at samba.org-20080930031022-prh9bagme9f54b3k
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2008-10-08 04:31:59 +0200
message:
  Use new bzrlib.api functions.
modified:
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
=== modified file '__init__.py'
--- a/__init__.py	2008-09-24 16:01:38 +0000
+++ b/__init__.py	2008-10-08 02:31:59 +0000
@@ -32,6 +32,7 @@
 """
 import bzrlib
 from bzrlib import log
+import bzrlib.api, bzrlib.repository
 from bzrlib.bzrdir import BzrDirFormat, format_registry
 from bzrlib.errors import BzrError
 from bzrlib.commands import Command, register_command, display_command, Option
@@ -53,28 +54,8 @@
     version_string = '%d.%d.%d%s%d' % version_info
 __version__ = version_string
 
-COMPATIBLE_BZR_VERSIONS = [(1, 6), (1, 7)]
-
-def check_bzrlib_version(desired):
-    """Check that bzrlib is compatible.
-
-    If version is < all compatible version, assume incompatible.
-    If version is compatible version + 1, assume compatible, with deprecations
-    Otherwise, assume incompatible.
-    """
-    bzrlib_version = bzrlib.version_info[:2]
-    if (bzrlib_version in desired or 
-        ((bzrlib_version[0], bzrlib_version[1]-1) in desired and 
-         bzrlib.version_info[3] in ('dev', 'exp'))):
-        return
-    if bzrlib_version < desired[0]:
-        raise BzrError('Installed bzr version %s is too old to be used with bzr-svn, at least %s.%s required' % (bzrlib.__version__, desired[0][0], desired[0][1]))
-    else:
-        warning('bzr-svn is not up to date with installed bzr version %s.'
-                ' \nThere should be a newer version of bzr-svn available.',
-                bzrlib.__version__)
-        if not (bzrlib_version[0], bzrlib_version[1]-1) in desired:
-            raise BzrError('Version mismatch')
+COMPATIBLE_BZR_VERSIONS = [(1, 9, 0)]
+
 
 def check_subversion_version():
     """Check that Subversion is compatible.
@@ -170,7 +151,8 @@
     if _versions_checked:
         return
     _versions_checked = True
-    check_bzrlib_version(COMPATIBLE_BZR_VERSIONS)
+    bzrlib.api.require_any_api(bzrlib, COMPATIBLE_BZR_VERSIONS)
+
 
 _optimizers_registered = False
 def lazy_register_optimizers():




More information about the bazaar-commits mailing list