Fixing Import Cycles.
Sean Farley
sean at farley.io
Tue Feb 23 21:25:03 EST 2016
Pulkit Goyal <7895pulkit at gmail.com> writes:
> Well doing this also resolves our next import cycle which was
>
> Import cycle: hgext.largefiles.basestore -> hgext.largefiles.wirestore ->
> hgext.largefiles.remotestore -> hgext.largefiles.basestore
>
> The remotestore file require to import the basestore to use the same
> StoreError class but since we have moved it in localstore file we can
> easily remove that import cycle.
>
> diff -r 2e11f6756d9c hgext/largefiles/remotestore.py
> --- a/hgext/largefiles/remotestore.py Tue Feb 16 14:49:29 2016 +0000
> +++ b/hgext/largefiles/remotestore.py Wed Feb 24 07:36:16 2016 +0530
> @@ -12,7 +12,7 @@
> from mercurial.i18n import _
>
> import lfutil
> -import basestore
> +import localstore
>
> class remotestore(basestore.basestore):
This seems to have been missed.
> '''a largefile store accessed over a network'''
> @@ -52,7 +52,7 @@
> except urllib2.HTTPError as e:
> # 401s get converted to error.Aborts; everything else is fine
> being
> # turned into a StoreError
> - raise basestore.StoreError(filename, hash, self.url, str(e))
> + raise localstore.StoreError(filename, hash, self.url, str(e))
There's also another line below the 'except IOError as e:' that needs to
be replaced.
> And something good pops out when I run
> hg locate 'mercurial/**.py' 'hgext/**.py' | sed 's-\\-/-g' | python
> "$import_checker" -
> No more cyclic imports. Seriously. :)
Yep, I can confirm that command succeeds but since I already spotted
some errors, I am a bit dubious that all cycles are removed. Let's start
by having you run the entire test suite which should spot the errors I
already mentioned. Then we can go from there.
More information about the Mercurial-devel
mailing list