-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/hooks.pyc

ó
X`Oc@@s1dZddlmZddlmZmZddlmZeeƒdƒdej	fd„ƒYZ
d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJfZe
ƒZx*eD]"\Z
ZZeje
eeƒq¨W[[
[[d3„Zd4efd5„ƒYZd6efd7„ƒYZd8Zd9„ZiZd:„Zd;S(Ks!Support for plugin hooking logic.i(tabsolute_import(tregistrytsymbol_versioning(tlazy_imports
import textwrap

from bzrlib import (
    _format_version_tuple,
    errors,
    pyutils,
    )
from bzrlib.i18n import gettext
tKnownHooksRegistrycB@s#eZd„Zd„Zd„ZRS(cC@s|j||f||ƒdS(N(t
register_lazy(tselfthook_module_namethook_member_namethook_factory_member_name((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pytregister_lazy_hook,scc@s/x(|jƒD]}||j|ƒfVq
WdS(s.Yield (hook_key, (parent_object, attr)) tuples for every registered
        hook, where 'parent_object' is the object that holds the hook
        instance.

        This is useful for resetting/restoring all the hooks to a known state,
        as is done in bzrlib.tests.TestCase._clear_hooks.
        N(tkeystkey_to_parent_and_attribute(Rtkey((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pytiter_parent_objects1scC@s=|\}}tj||ƒ\}}}tj||ƒ|fS(s=Convert a known_hooks key to a (parent_obj, attr) pair.

        :param key: A tuple (module_name, member_name) as found in the keys of
            the known_hooks registry.
        :return: The parent_object of the hook and the name of the attribute on
            that parent object where the hook is kept.
        (tpyutilstcalc_parent_nametget_named_object(Rt.1tmodule_nametmember_namet
parent_modt
parent_membertattr((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyR<s		(t__name__t
__module__R
RR(((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyR&s		s
bzrlib.branchsBranch.hookstBranchHookssbzrlib.controldirsControlDir.hookstControlDirHookssbzrlib.commandss
Command.hookstCommandHookss
bzrlib.configtConfigHookst_ConfigHookssbzrlib.infothookst	InfoHookssbzrlib.locks
Lock.hookst	LockHookssbzrlib.mergesMerger.hookst
MergeHookssbzrlib.msgeditortMessageEditorHookssbzrlib.mutabletreesMutableTree.hookstMutableTreeHookssbzrlib.smart.clients_SmartClient.hookstSmartClientHookssbzrlib.smart.serversSmartTCPServer.hookstSmartServerHookss
bzrlib.statustStatusHookssbzrlib.transportsTransport.hookstTransportHookss&bzrlib.version_info_formats.format_riosRioVersionInfoBuilder.hookstRioVersionInfoBuilderHookssbzrlib.merge_directivesBaseMergeDirective.hookstMergeDirectiveHookscC@s|\}}tj||ƒS(sÁConvert a known_hooks key to a object.

    :param key: A tuple (module_name, member_name) as found in the keys of
        the known_hooks registry.
    :return: The object this specifies.
    (RR(t.0RR((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pytknown_hooks_key_to_objectcs	tHookscB@sheZdZd
d
d„Zd
d„Zd„Zd„Zd„Zd„Z	d„Z
d„Zd	„ZRS(s“A dictionary mapping hook name to a list of callables.

    e.g. ['FOO'] Is the list of items to be called when the
    FOO hook is triggered.
    cC@s5tj|ƒi|_i|_||_||_dS(sCreate a new hooks dictionary.

        :param module: The module from which this hooks dictionary should be loaded
            (used for lazy hooks)
        :param member_name: Name under which this hooks dictionary should be loaded.
            (used for lazy hooks)
        N(tdictt__init__t_callable_namest_lazy_callable_namest_modulet_member_name(RtmoduleR((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyR/ts

			cC@s†||krtj|ƒ‚n|jrKtj|j|j|fgƒ}nd}td|d|d|d|d|ƒ}|||<dS(sOAdd a hook point to this dictionary.

        :param name: The name of the hook, for clients to use when registering.
        :param doc: The docs for the hook.
        :param introduced: When the hook was introduced (e.g. (0, 15)).
        :param deprecated: When the hook was deprecated, None for
            not-deprecated.
        tnametdoct
introducedt
deprecatedt	callbacksN(terrorstDuplicateKeyR2t_lazy_hookst
setdefaultR3tNonet	HookPoint(RR5R6R7R8R9t	hookpoint((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pytadd_hook‚s		cC@st|jƒƒ}g}|jj}|j|ƒ|jdt|ƒƒ|jdƒx›|D]“}||}y|j|jƒƒWq\tk
rîg}|j|ƒ|jdt|ƒƒ|jdƒ|jd|fƒ|j|ƒq\Xq\Wdj	|ƒS(sGenerate the documentation for this Hooks instance.

        This introspects all the individual hooks and returns their docs as well.
        t-tt~sEAn old-style hook. For documentation see the __init__ method of '%s'
s
(
tsortedRt	__class__RtappendtlentdocstAttributeErrortextendtjoin(Rt
hook_namest	hook_docsR5t	hook_namethooktstrings((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyRI–s&






	cC@se|jj|dƒ}|dkrQ|dk	rQ|jj|j|jfdƒ}n|dkradS|S(s>Get the name for a_callable for UI display.

        If no name has been registered, the string 'No hook name' is returned.
        We use a fixed string rather than repr or the callables module because
        the code names are rarely meaningful for end users and this is not
        intended for debugging.
        sNo hook nameN(R0tgetR>R1RR(Rt
a_callableR5((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyt
get_hook_name°s	cC@s¬y||}Wn)tk
r9tj|jj|ƒ‚nXyt|dƒ}Wn&tk
rutj|j|ƒ‚nX||||ƒ|dk	r¨|j
|||ƒndS(s»Install a_callable in to the hook hook_name lazily, and label it.

        :param hook_name: A hook name. See the __init__ method for the complete
            list of hooks.
        :param callable_module: Name of the module in which the callable is
            present.
        :param callable_member: Member name of the callable.
        :param name: A name to associate the callable with, to show users what
            is running.
        t	hook_lazyN(tKeyErrorR:tUnknownHookRFRtgetattrRJtUnsupportedOperationtinstall_named_hook_lazyR>tname_hook_lazy(RROtcallable_moduletcallable_memberR5RPRU((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyRZÂs


cC@s’y||}Wn)tk
r9tj|jj|ƒ‚nXy|j|ƒWn!tk
rn|j||ƒnX|dk	rŽ|j	||ƒndS(sßInstall a_callable in to the hook hook_name, and label it name.

        :param hook_name: A hook name. See the __init__ method for the complete
            list of hooks.
        :param a_callable: The callable to be invoked when the hook triggers.
            The exact signature will depend on the hook - see the __init__
            method for details on each hook.
        :param name: A name to associate a_callable with, to show users what is
            running.
        N(
RVR:RWRFRRGRJRPR>t	name_hook(RRORSR5RP((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pytinstall_named_hookÜs

cC@s„y||}Wn)tk
r9tj|jj|ƒ‚nXyt|dƒ}Wn&tk
rutj|j|ƒ‚nX||ƒdS(sƒUninstall named hooks.

        :param hook_name: Hook point name
        :param label: Label of the callable to uninstall
        t	uninstallN(	RVR:RWRFRRXRJRYtuninstall_named_hook(RROtlabelRPR`((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyRaós

cC@s||j|<dS(s=Associate name with a_callable to show users what is running.N(R0(RRSR5((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyR^scC@s||j||f<dS(N(R1(RR\R]t
callable_name((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyR[sN(
RRt__doc__R>R/RARIRTRZR_RaR^R[(((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyR-ms						R?cB@seeZdZd
d
d„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d„Zd	„ZRS(sLA single hook that clients can register to be called back when it fires.

    :ivar name: The name of the hook.
    :ivar doc: The docs for using the hook.
    :ivar introduced: A version tuple specifying what version the hook was
        introduced in. None indicates an unknown version.
    :ivar deprecated: A version tuple specifying what version the hook was
        deprecated or superseded in. None indicates that the hook is not
        superseded or deprecated. If the hook is superseded then the doc
        should describe the recommended replacement hook to register for.
    cC@sI||_||_||_||_|dkr<g|_n	||_dS(s>Create a HookPoint.

        :param name: The name of the hook, for clients to use when registering.
        :param doc: The docs for the hook.
        :param introduced: When the hook was introduced (e.g. (0, 15)).
        :param deprecated: When the hook was deprecated, None for
            not-deprecated.
        N(R5RdR7R8R>t
_callbacks(RR5R6R7R8R9((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyR/s					cC@síg}|j|jƒ|jdt|jƒƒ|jdƒ|jrXt|jƒ}nd}|jtdƒ|ƒ|jr§t|jƒ}|jtdƒ|ƒn|jdƒ|jtj	|j
dtƒƒ|jdƒdj|ƒS(scGenerate the documentation for this HookPoint.

        :return: A string terminated in 
.
        RDRCtunknownsIntroduced in: %ssDeprecated in: %stbreak_long_wordss
(
RGR5RHR7t_format_version_tupletgettextR8RKttextwraptwrapRdtFalseRL(RRQtintroduced_stringtdeprecated_string((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyRI,s 
		


cC@s(t|ƒt|ƒko'|j|jkS(N(ttypet__dict__(Rtother((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyt__eq__CscC@s,tj||ƒ}|jj||fƒdS(sVLazily register a callback to be called when this HookPoint fires.

        :param callback_module: Module of the callable to use when this
            HookPoint fires.
        :param callback_member: Member name of the callback.
        :param callback_label: A label to show in the UI while this callback is
            processing.
        N(Rt_LazyObjectGetterReRG(Rtcallback_moduletcallback_membertcallback_labelt
obj_getter((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyRUFs			cC@s)tj|ƒ}|jj||fƒdS(sõ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.
        N(Rt
_ObjectGetterReRG(RtcallbackRvRw((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyRPSscC@s†g}x9|jD].}|\}}||kr|j|ƒqqW|gkratd|ƒ‚nx|D]}|jj|ƒqhWdS(spUninstall the callback with the specified label.

        :param label: Label of the entry to uninstall
        sNo entry with label %rN(ReRGRVtremove(RRbtentries_to_removetentrytentry_callbacktentry_label((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyR`]s
cC@sd„|jDƒS(Ncs@s!|]\}}|jƒVqdS(N(tget_obj(R+RyR5((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pys	<genexpr>ms(Re(R((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyt__iter__lscC@s
t|jƒS(N(RHRe(R((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyt__len__oscC@sÖg}|jdt|ƒjƒ|j|jƒ|jdƒ|j}xT|D]L\}}|jt|jƒƒƒ|jdƒ|j|ƒ|jdƒqMWt|ƒdkr¼d|d<n|jdƒd	j|ƒS(
Ns<%s(s), callbacks=[t(s),it)iÿÿÿÿs]>RC(	RGRoRR5RetreprRRHRL(RRQR9Ryt
callback_name((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyt__repr__rs
	



N(
RRRdR>R/RIRrRURPR`R€RR†(((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyR?
s			
	
			sý
Hooks
=====

Introduction
------------

A hook of type *xxx* of class *yyy* needs to be registered using::

  yyy.hooks.install_named_hook("xxx", ...)

See :doc:`Using hooks<../user-guide/hooks>` in the User Guide for examples.

The class that contains each hook is given before the hooks it supplies. For
instance, BranchHooks as the class is the hooks class for
`bzrlib.branch.Branch.hooks`.

Each description also indicates whether the hook runs on the client (the
machine where bzr was invoked) or the server (the machine addressed by
the branch URL).  These may be, but are not necessarily, the same machine.

Plugins (including hooks) are run on the server if all of these is true:

  * The connection is via a smart server (accessed with a URL starting with
    "bzr://", "bzr+ssh://" or "bzr+http://", or accessed via a "http://"
    URL when a smart server is available via HTTP).

  * The hook is either server specific or part of general infrastructure rather
    than client specific code (such as commit).

cC@sRtg}x9ttjƒƒD]%}t|ƒ}|j|jƒƒqWdj|ƒS(Ns
(t_help_prefixREtknown_hooksRR,RGRIRL(ttopictsegmentsthook_keyR((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pythooks_help_text¤s
	cC@sA|||f}tj|ƒ}tj|gƒj||fƒdS(siInstall 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.
    N(RRxR<R=RG(thookpoints_modulethookpoints_nameRORSR5R
Rw((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pytinstall_lazy_named_hook±sN(s
bzrlib.branchsBranch.hooksR(sbzrlib.controldirsControlDir.hooksR(sbzrlib.commandss
Command.hooksR(s
bzrlib.configRR(sbzrlib.infoshooksR (sbzrlib.locks
Lock.hooksR!(sbzrlib.mergesMerger.hooksR"(sbzrlib.msgeditorshooksR#(sbzrlib.mutabletreesMutableTree.hooksR$(sbzrlib.smart.clients_SmartClient.hooksR%(sbzrlib.smart.serversSmartTCPServer.hooksR&(s
bzrlib.statusshooksR'(sbzrlib.transportsTransport.hooksR((s&bzrlib.version_info_formats.format_riosRioVersionInfoBuilder.hooksR)(sbzrlib.merge_directivesBaseMergeDirective.hooksR*(Rdt
__future__RtbzrlibRRtbzrlib.lazy_importRtglobalstRegistryRt_builtin_known_hooksRˆt_hook_modulet_hook_attributet_hook_classR
R,R.R-tobjectR?R‡RŒR<R(((s0/usr/lib/python2.7/dist-packages/bzrlib/hooks.pyt<module>sD		$			
 •	


Copyright © 2017 || Recoded By Mr.Bumblebee