[PATCH 2 of 3] convert: fix relative import of stdlib module in subversion
pierre-yves.david at ens-lyon.org
Fri Mar 11 09:13:54 EST 2016
On 03/11/2016 01:00 PM, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1457700944 -32400
> # Fri Mar 11 21:55:44 2016 +0900
> # Node ID cc86ef8d2f0b7ebaf7b4de4692b8d4cfefe36f04
> # Parent 59aa1b8645de514bf3f5da9e0c09e94321b92351
> convert: fix relative import of stdlib module in subversion
> Before this patch, import-checker reports "relative import of stdlib
> module" error for importing Pool and SubversionException from svn.core
> in subversion.py.
> To fix this relative import of stdlib module, this patch adds prefix
> 'svn.core.' to Pool and SubversionException in source.
> These 'svn.core.' relative accessing shouldn't cause performance
> impact, because there are much more code paths accessing to
> 'svn.core.' relative properties.
> BTW, in transport.py, this error is avoided by assignment below.
> SubversionException = svn.core.SubversionException
> But this can't be used in subversion.py case, because:
> - such assignment in indented code block causes "don't use camelcase
> in identifiers" error of check-code.py
> - but it should be placed in indented block, because svn is None at
> failure of importing subversion python binding libraries (=
> examination of 'svn' is needed)
> diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
> --- a/hgext/convert/subversion.py
> +++ b/hgext/convert/subversion.py
> @@ -43,10 +43,6 @@ NoRepo = common.NoRepo
> # these bindings.
> - from svn.core import (
> - Pool,
> - SubversionException,
> - )
> import svn
> import svn.client
> import svn.core
this was broken then the module was missing because no actual import
were triggered, so no ImportError were raised.
I fixed it in flight.
More information about the Mercurial-devel