comparison mercurial/extensions.py @ 32417:f40dc6f7c12f

profiling: allow loading profiling extension before everything else 6d642ecf1a89 makes profiler start early without loading extensions. That makes it impossible for an extension to add customized profilers. This patch adds a special case: if a profiler is not found but an extension with the same name could be loaded, load that extension first, and expect it to have a "profile" contextmanager method. This allows customized profilers and extension setup time is still profiled.
author Jun Wu <quark@fb.com>
date Mon, 22 May 2017 01:17:49 -0700
parents 9a3e88d4a030
children de09138bf0f5
comparison
equal deleted inserted replaced
32416:9a3e88d4a030 32417:f40dc6f7c12f
179 raise 179 raise
180 extsetup() # old extsetup with no ui argument 180 extsetup() # old extsetup with no ui argument
181 181
182 def loadall(ui, whitelist=None): 182 def loadall(ui, whitelist=None):
183 result = ui.configitems("extensions") 183 result = ui.configitems("extensions")
184 if whitelist: 184 if whitelist is not None:
185 result = [(k, v) for (k, v) in result if k in whitelist] 185 result = [(k, v) for (k, v) in result if k in whitelist]
186 newindex = len(_order) 186 newindex = len(_order)
187 for (name, path) in result: 187 for (name, path) in result:
188 if path: 188 if path:
189 if path[0:1] == '!': 189 if path[0:1] == '!':