convert: improve reporting of invalid svn bindings
authorPatrick Mezard <pmezard@gmail.com>
Sun, 30 Nov 2008 22:51:42 +0100
changeset 7447 4fd92687f331
parent 7446 2d2e0be762be
child 7448 7900d240c3d8
convert: improve reporting of invalid svn bindings
hgext/convert/subversion.py
--- a/hgext/convert/subversion.py	Sun Nov 30 22:01:26 2008 +0100
+++ b/hgext/convert/subversion.py	Sun Nov 30 22:51:42 2008 +0100
@@ -32,8 +32,8 @@
 
 from cStringIO import StringIO
 
-from common import NoRepo, commit, converter_source, encodeargs, decodeargs
-from common import commandline, converter_sink, mapfile
+from common import NoRepo, MissingTool, commit, encodeargs, decodeargs
+from common import commandline, converter_source, converter_sink, mapfile
 
 try:
     from svn.core import SubversionException, Pool
@@ -155,7 +155,16 @@
         try:
             SubversionException
         except NameError:
-            raise NoRepo('Subversion python bindings could not be loaded')
+            raise MissingTool(_('Subversion python bindings could not be loaded'))
+
+        try:
+            version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR
+            if version < (1, 4):
+                raise MissingTool(_('Subversion python bindings %d.%d found, '
+                                    '1.4 or later required') % version)
+        except AttributeError:
+            raise MissingTool(_('Subversion python bindings are too old, 1.4 '
+                                'or later required'))
 
         self.encoding = locale.getpreferredencoding()
         self.lastrevs = {}