subvertpy_wrapper: don't assume the version is a three-tuple (fixes #206)

0.7.3.1 breaks this. While at it, the capitalisation of `Subvertpy' is
made consistent, and the Subversion tag, if present, is included in
the output.
This commit is contained in:
Dan Villiom Podlaski Christiansen 2010-09-14 21:02:49 +02:00
parent 76a82dfc04
commit 6909ff1bc2

View File

@ -26,23 +26,30 @@ try:
from subvertpy import ra from subvertpy import ra
import subvertpy import subvertpy
except ImportError: except ImportError:
raise ImportError('subvertpy %d.%d.%d or later required, but not found' raise ImportError('Subvertpy %d.%d.%d or later required, but not found'
% subvertpy_required) % subvertpy_required)
def _versionstr(v):
return '.'.join(str(d) for d in v)
if subvertpy.__version__ < subvertpy_required: #pragma: no cover if subvertpy.__version__ < subvertpy_required: #pragma: no cover
raise ImportError('subvertpy %d.%d.%d or later required, ' raise ImportError('Subvertpy %s or later required, '
'but %d.%d.%d found' % 'but %s found'
(subvertpy_required + subvertpy.__version__)) % (_versionstr(subvertpy_required),
_versionstr(subvertpy.__version__)))
if subvertpy.wc.version()[:3] < subversion_required: if subvertpy.wc.version()[:3] < subversion_required:
raise ImportError('Subversion %d.%d.%d or later required, ' raise ImportError('Subversion %s or later required, '
'but %d.%d.%d found' % 'but Subvertpy is using %s'
(subversion_required + subvertpy.wc.version()[:3])) % (_versionstr(subversion_required),
_versionstr(subvertpy.wc.version()[:3])))
def version(): def version():
return ('%d.%d.%d' % subvertpy.wc.version()[:3], svnvers = _versionstr(subvertpy.wc.version()[:3])
'Subvertpy %d.%d.%d' % subvertpy.__version__) if subvertpy.wc.version()[3]:
svnvers += '-' + subvertpy.wc.version()[3]
return (svnvers, 'Subvertpy ' + _versionstr(subvertpy.__version__))
# exported values # exported values
ERR_FS_CONFLICT = subvertpy.ERR_FS_CONFLICT ERR_FS_CONFLICT = subvertpy.ERR_FS_CONFLICT