> On Apr 13, 2018, at 9:11 AM, Yuya Nishihara <y...@tcha.org> wrote:
> 
>> On Thu, 12 Apr 2018 13:35:50 -0400, Matt Harbison wrote:
>> # HG changeset patch
>> # User Matt Harbison <matt_harbi...@yahoo.com>
>> # Date 1523332699 14400
>> #      Mon Apr 09 23:58:19 2018 -0400
>> # Node ID 986b51f15e9bce19b2f67573ff76612540320d1b
>> # Parent  2e0e61312a257708a70201427b31deba964e9b05
>> dispatch: add a whitelist map of commands to implicitly loaded extensions
> 
>> class request(object):
>>     def __init__(self, args, ui=None, repo=None, fin=None, fout=None,
>>                  ferr=None, prereposetups=None):
>> @@ -843,6 +852,20 @@ def _dispatch(req):
>>         fullargs = args
>>         cmd, func, args, options, cmdoptions = _parse(lui, args)
>> 
>> +        # resolve aliases back to the core function
>> +        entrypoint = func
>> +        if isinstance(entrypoint, cmdalias):
>> +            entrypoint = entrypoint.fn
>> +
>> +        if entrypoint in extensionwhitelist:
>> +            configured = [ext for (ext, _path) in 
>> ui.configitems("extensions")]
>> +            missing = [ext for ext in extensionwhitelist[entrypoint]
>> +                       if ext not in configured]
>> +            for ext in missing:
>> +                ui.setconfig('extensions', ext, '', source='internal')
>> +            if missing:
>> +                extensions.loadall(ui, missing)
> 
> I'm -1 on this because loading extra Python module isn't always instant, and
> the loaded extension persists forever, which can be a problem for 
> command-server
> process.

Good point. Any alternate ideas?  I wasn’t sure what the bundlepart idea would 
look like, because presumably this needs to be loaded pretty early in the 
startup process.

One thing I like about this is the user doesn’t have to do anything to switch.  
I can send out an email saying “upgrade to 4.6”, convert on the server, and 
nothing changes for the developer. Otherwise, everyone has to enable the 
extension in their user settings, or alias clone and pull to enable it anyway.

_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to