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

Azhagu Selvan SP tamizhgeek at gmail.com
Wed Feb 23 13:47:51 CST 2011


# HG changeset patch
# User Azhagu Selvan SP <tamizhgeek at gmail.com>
# Date 1298490255 -19800
# Node ID e27a6c78651d65400d420cf0b43153667b5cf74f
# Parent  45ec9c4e74dfbd50ffe863d697f1d7a81c9fc39a
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 45ec9c4e74df -r e27a6c78651d hgext/convert/subversion.py
--- a/hgext/convert/subversion.py	Thu Feb 24 01:09:36 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 = []


More information about the Mercurial-devel mailing list