def hook(self, callback, callback_label): """Register a callback to be called when this HookPoint fires. :param callback: The callable to use when this HookPoint fires. :param callback_label: A label to show in the UI while this callback is processing. """ obj_getter = registry._ObjectGetter(callback) self._callbacks.append((obj_getter, callback_label))
def install_lazy_named_hook(hookpoints_module, hookpoints_name, hook_name, a_callable, name): """Install a callable in to a hook lazily, and label it name. :param hookpoints_module: Module name of the hook points. :param hookpoints_name: Name of the hook points. :param hook_name: A hook name. :param callable: a callable to call for the hook. :param name: A name to associate a_callable with, to show users what is running. """ key = (hookpoints_module, hookpoints_name, hook_name) obj_getter = registry._ObjectGetter(a_callable) _lazy_hooks.setdefault(key, []).append((obj_getter, name))
def append_possible_revspec(cls, revspec): """Append a possible DWIM revspec. :param revspec: Revision spec to try. """ cls._possible_revspecs.append(registry._ObjectGetter(revspec))