[1 of 3]Fixing Import Cycles.

Yuya Nishihara yuya at tcha.org
Tue Mar 1 13:50:06 UTC 2016


On Tue, 1 Mar 2016 01:59:15 +0530, Pulkit Goyal wrote:
> I was working on fixing import cycles in the codebase. The first import
> cycle was between hgext/largefiles/basestore and
> hgext/largefiles/localstore. The dependency can be solved by resolving the
> dependency of localstore on basestore. The dependency was of StoreError
> class which was required in the both the files but the only reason to
> import basestore in localstore.
> 
> So rather we define the StoreError class in localstore rather than
> basestore. Its necessary to import localstore in basestore. So this is the
> only way around. I guess.

I think _openstore() and _storeprovider dict should be moved out from the
basestore module. It seems the import cycle is caused because the basestore
hosts both the base class of all xxxstore classes (bottom layer), and the
facade to xxxstore classses (top layer).

   basestore.basestore <- xxxstore.xxxstore <- basestore._openstore()


More information about the Mercurial-devel mailing list