403 loaded = (_extensions[extension] is not None) |
403 loaded = (_extensions[extension] is not None) |
404 callback(loaded=loaded) |
404 callback(loaded=loaded) |
405 else: |
405 else: |
406 _aftercallbacks.setdefault(extension, []).append(callback) |
406 _aftercallbacks.setdefault(extension, []).append(callback) |
407 |
407 |
|
408 def populateui(ui): |
|
409 """Run extension hooks on the given ui to populate additional members, |
|
410 extend the class dynamically, etc. |
|
411 |
|
412 This will be called after the configuration is loaded, and/or extensions |
|
413 are loaded. In general, it's once per ui instance, but in command-server |
|
414 and hgweb, this may be called more than once with the same ui. |
|
415 """ |
|
416 for name, mod in extensions(ui): |
|
417 hook = getattr(mod, 'uipopulate', None) |
|
418 if not hook: |
|
419 continue |
|
420 try: |
|
421 hook(ui) |
|
422 except Exception as inst: |
|
423 ui.traceback(force=True) |
|
424 ui.warn(_('*** failed to populate ui by extension %s: %s\n') |
|
425 % (name, stringutil.forcebytestr(inst))) |
|
426 |
408 def bind(func, *args): |
427 def bind(func, *args): |
409 '''Partial function application |
428 '''Partial function application |
410 |
429 |
411 Returns a new function that is the partial application of args and kwargs |
430 Returns a new function that is the partial application of args and kwargs |
412 to func. For example, |
431 to func. For example, |