[PATCH] subversion: show the reason if bindings import failed
anatoly techtonik
techtonik at gmail.com
Sat Jan 8 06:21:46 CST 2011
# HG changeset patch
# User anatoly techtonik <techtonik at gmail.com>
# Date 1294489093 -7200
# Node ID 02f8a2e5b2482b64cf1746818d843ca67c7c24b0
# Parent 72a3f1056c7e8ed4d336a986e58ed95008d14480
subversion: show the reason if bindings import failed
This shows the following message in debug mode:
Subversin bindings import failed:
ImportError: No module named _core
diff -r 72a3f1056c7e -r 02f8a2e5b248 hgext/convert/subversion.py
--- a/hgext/convert/subversion.py Fri Jan 07 18:41:18 2011 +0200
+++ b/hgext/convert/subversion.py Sat Jan 08 14:18:13 2011 +0200
@@ -22,6 +22,8 @@
from common import NoRepo, MissingTool, commit, encodeargs, decodeargs
from common import commandline, converter_source, converter_sink, mapfile
+bindings = True
+bindexception = None
try:
from svn.core import SubversionException, Pool
import svn
@@ -35,7 +37,9 @@
module='svn.core',
category=DeprecationWarning)
-except ImportError:
+except ImportError, inst:
+ bindings = False
+ bindexception = inst
pass
class SvnPathNotFound(Exception):
@@ -210,9 +214,9 @@
raise NoRepo(_("%s does not look like a Subversion repository")
% url)
- try:
- SubversionException
- except NameError:
+ if not bindings:
+ ui.debug("Subversion bindings import failed:\n %s: %s\n" %
+ (bindexception.__class__.__name__, bindexception))
raise MissingTool(_('Subversion python bindings could not be loaded'))
try:
More information about the Mercurial-devel
mailing list