comparison mercurial/extensions.py @ 32416:9a3e88d4a030

extensions: allow loading a whitelisted subset of extensions This feature will be used by the next patch.
author Jun Wu <quark@fb.com>
date Mon, 22 May 2017 00:51:56 -0700
parents d47d7d3bd07b
children f40dc6f7c12f
comparison
equal deleted inserted replaced
32415:9695aca1a3a0 32416:9a3e88d4a030
177 except TypeError: 177 except TypeError:
178 if inspect.getargspec(extsetup).args: 178 if inspect.getargspec(extsetup).args:
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): 182 def loadall(ui, whitelist=None):
183 result = ui.configitems("extensions") 183 result = ui.configitems("extensions")
184 if whitelist:
185 result = [(k, v) for (k, v) in result if k in whitelist]
184 newindex = len(_order) 186 newindex = len(_order)
185 for (name, path) in result: 187 for (name, path) in result:
186 if path: 188 if path:
187 if path[0:1] == '!': 189 if path[0:1] == '!':
188 _disabledextensions[name] = path[1:] 190 _disabledextensions[name] = path[1:]