[PATCH 2 of 3] extensions: register functions always at loading extension (issue5601)

Yuya Nishihara yuya at tcha.org
Fri Jun 23 23:10:15 EDT 2017


On Sat, 24 Jun 2017 02:48:56 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1498239560 -32400
> #      Sat Jun 24 02:39:20 2017 +0900
> # Node ID bd02107d5a20adff17f744a422b2530284215a7a
> # Parent  5808466886a165460b52de226ab5d3c4c1379692
> extensions: register functions always at loading extension (issue5601)

This makes me feel a bit awkward, but I couldn't come up with a better idea.
So I'm going to queue this in a few days.

> To register functions always at loading new extension, this patch
> moves implementation for extra loading from dispatch._dispatch() to
> extensions.loadall().
> 
> AFAIK, only commands module causes cyclic dependency between
> extensions module, but this patch imports all related modules just
> before extra loading in loadall(), in order to centralize them.

For "commands -> extensions.extensions() -> commands.loadcmdtable",
maybe we could split loader part from extensions.py. For example,

  extensions.loadall(ui, extraloaders)

But still we'll have to resolve "localrepo -> extensions.loadall()" cycle.
Perhaps, localrepository._loadextensions() shouldn't touch the global tables
because the repo may be a peer repository (and the extensions for the main
repo should be loaded beforehand.) However, hgweb appears not loading
extensions explicitly, which is probably a bug.


More information about the Mercurial-devel mailing list