# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@gmail.com>
# Date 1285776266 -7200
# Node ID 2c278d71b73d49c9a04e9ab8f2b81060d6702a0c
# Parent  f28c6d5d73fdb766452b07013ca74c8bfa0bc612
subvertpy wrapper: check against Subversion version compiled against.

The previously used method for checking the Subversion version,
subvertpy.wc.version(), reported back the version of the runtime
library used. This is not what we're interested in; we want to know
what version it was compiled against.

These functions were not available in Subvertpy 0.7.3, necessitating
the earlier bump of the version requirement to 0.7.4.

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
@@ -25,6 +25,8 @@ 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)
@@ -38,17 +40,17 @@ if subvertpy.__version__ < subvertpy_req
                       % (_versionstr(subvertpy_required),
                          _versionstr(subvertpy.__version__)))
 
-if subvertpy.wc.version()[:3] < subversion_required:
+if subversion_version[:3] < subversion_required:
     raise ImportError('Subversion %s or later required, '
                       'but Subvertpy is using %s'
                       % (_versionstr(subversion_required),
-                         _versionstr(subvertpy.wc.version()[:3])))
+                         _versionstr(subversion_version[:3])))
 
 
 def version():
-    svnvers = _versionstr(subvertpy.wc.version()[:3])
-    if subvertpy.wc.version()[3]:
-        svnvers += '-' + subvertpy.wc.version()[3]
+    svnvers = _versionstr(subversion_version[:3])
+    if subversion_version[3]:
+        svnvers += '-' + subversion_version[3]
     return (svnvers, 'Subvertpy ' + _versionstr(subvertpy.__version__))
 
 # exported values