# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1286121200 -7200 # Node ID db0eb6237420293133aa7f11d155c5e000eaa9eb # Parent ae5968ffe6fe5a31e75670f2d4eb5dbe956b0f50 wrapper: fail properly with unsupported versions of Subvertpy (fixes #212) Calling subvertpy.wc.api_version() will raise an AttributeError with versions of Subvertpy prior to 0.7.4. This AttributeError completely breaks hgsubversion, as our infrastructure assumes that only ImportErrors are raised during imports. Delaying the call to api_version() until after the Subvertpy version check should make things work again. diff --git a/hgsubversion/svnwrap/subvertpy_wrapper.py b/hgsubversion/svnwrap/subvertpy_wrapper.py --- a/hgsubversion/svnwrap/subvertpy_wrapper.py +++ b/hgsubversion/svnwrap/subvertpy_wrapper.py @@ -24,8 +24,6 @@ try: from subvertpy import properties from subvertpy import ra import subvertpy - - subversion_version = subvertpy.wc.api_version() except ImportError: raise ImportError('Subvertpy %d.%d.%d or later required, but not found' % subvertpy_required) @@ -39,6 +37,8 @@ if subvertpy.__version__ < subvertpy_req % (_versionstr(subvertpy_required), _versionstr(subvertpy.__version__))) +subversion_version = subvertpy.wc.api_version() + if subversion_version[:3] < subversion_required: raise ImportError('Subversion %s or later required, ' 'but Subvertpy is using %s'