[PATCH] convert/svn: Abort operation when python bindings are not available
Azhagu Selvan SP
tamizhgeek at gmail.com
Sun Feb 20 10:29:51 UTC 2011
On Sun, 2011-02-20 at 02:31 +0100, Mads Kiilerich wrote:
> No. transport.py will unconditionally import svn, so it has to be
> imported in the try/except ... at least in principle ...
>
> (The confusing exception is that demandload usually will delay the
> exception to the first time the imported module is used. We must make
> sure that doesn't cause trouble in either direction. The import from
> svn.core will however not be delayed and it will fail immediately if it
> fails.)
>
> I think the best and most maintainable solution is to set svn to None if
> the imports fails and then make sure that all (2?) relevant entry points
> fails properly "if not svn" (insteaf of accessing SubversionException).
Hey I just realised the problem here. I was using convert extension to
convert a hg repo to a subversion repository. In the subversion.py, the
svn_source class constructor has a import check for svn bindings,
<snip>
try:
SubversionException
except NameError:
raise MissingTool(_('Subversion python bindings could not be loaded'))
</snip>
This is absent in the svn_sink class :-/ That's why I got a unhandled
exception.
But as you said I ll change these checks to 'if not svn' for better
maintainability. Will test and post the patch.
Thanks!
--
Azhagu Selvan SP
http://azhaguselvan.co.cc
More information about the Mercurial-devel
mailing list