[PATCH] [PATCH RESEND] convert/svn: Abort operation when python bindings are not available

Azhagu Selvan SP tamizhgeek at gmail.com
Tue Feb 22 11:02:23 CST 2011


# HG changeset patch
# User Azhagu Selvan SP <tamizhgeek at gmail.com>
# Date 1298394117 -19800
# Node ID 69dba6f17e3d3d7f1dd8a789cb7f2f4895bc948c
# Parent  35a8659c57b8f40bad009d0574749c9d749db20f
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.

diff -r 35a8659c57b8 -r 69dba6f17e3d hgext/convert/subversion.py
--- a/hgext/convert/subversion.py	Tue Feb 22 17:42:50 2011 +0530
+++ b/hgext/convert/subversion.py	Tue Feb 22 22:31:57 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 = []
@@ -968,7 +968,6 @@
         self.copies = []
         self.wc = None
         self.cwd = os.getcwd()
-
         path = os.path.realpath(path)
 
         created = False


More information about the Mercurial-devel mailing list