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.
--- 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 = []