convert/svn: abort operation when python bindings are not available stable
authorAzhagu Selvan SP <tamizhgeek@gmail.com>
Thu, 24 Feb 2011 01:14:15 +0530
branchstable
changeset 13480 69418d4525d1
parent 13479 b14ed1692b27
child 13481 4eb1e9d6a7c9
convert/svn: abort operation when python bindings are not available Subversion python bindings check was not present in svn_sink source class which made it fail while using svn as destination repository. Added a more maintainble svn bindings check for svn_source and svn_sink classes.
hgext/convert/subversion.py
--- a/hgext/convert/subversion.py	Thu Feb 24 00:45:02 2011 +0530
+++ b/hgext/convert/subversion.py	Thu Feb 24 01:14:15 2011 +0530
@@ -36,7 +36,7 @@
             category=DeprecationWarning)
 
 except ImportError:
-    pass
+    svn = None
 
 class SvnPathNotFound(Exception):
     pass
@@ -209,11 +209,8 @@
                 issvnurl(ui, url)):
             raise NoRepo(_("%s does not look like a Subversion repository")
                          % url)
-
-        try:
-            SubversionException
-        except NameError:
-            raise MissingTool(_('Subversion python bindings could not be loaded'))
+        if svn is None:
+            raise MissingTool(_('Could not load Subversion python bindings'))
 
         try:
             version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR
@@ -960,6 +957,9 @@
         return self.join('hg-authormap')
 
     def __init__(self, ui, path):
+
+        if svn is None:
+            raise MissingTool(_('Could not load Subversion python bindings'))
         converter_sink.__init__(self, ui, path)
         commandline.__init__(self, ui, 'svn')
         self.delete = []