chg and uisetup

Yuya Nishihara yuya at tcha.org
Wed Jul 13 11:26:47 EDT 2016


On Wed, 13 Jul 2016 16:09:32 +0100, Jun Wu wrote:
> Excerpts from Yuya Nishihara's message of 2016-07-13 23:32:50 +0900:
> >  4. run ui/extsetup and register commands, templates, etc. if there are
> >     preloaded and enabled extensions  
> 
> This is problematic, there are too many decorators to patch already and I
> think there are also non-decorator side-effect patterns used in the wild.

Huh? @command and @template* are carefully designed to not have import-time
side effect.

> The Python language is too free and developers can easily write code with
> all kinds of side-effects. We will never be confident enough: we cannot
> devel-warn them. And I can imagine developers yell at chg.
> 
> Just an example, I think this is a legit:
> 
>   from hgext import histedit
>   @histedit.action
>   ...

IMHO, that's invalid. Registering things while importing would leave None
object on import failure, result in cryptic error message. If @histedit.action
has a side effect, it should be done by ui/extsetup().


More information about the Mercurial-devel mailing list