-=[ Mr. Bumblebee ]=-
_Indonesia_

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

ó
ÊOc@@sXdZddlmZddlmZmZmZmZmZddl	m
Z
mZmZddl
mZddlmZmZmZdefd„ƒYZd	efd
„ƒYZdefd„ƒYZd
efd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd „ƒYZd!efd"„ƒYZ d#efd$„ƒYZ!d%efd&„ƒYZ"d'efd(„ƒYZ#d)efd*„ƒYZ$d+efd,„ƒYZ%d-efd.„ƒYZ&d/efd0„ƒYZ'd1S(2s2Server-side bzrdir related request implmentations.i(tabsolute_import(tbencodetbranchterrorst
repositoryturlutils(tBzrDirtBzrDirFormatt	BzrProber(tnetwork_format_registry(tFailedSmartServerResponsetSmartServerRequesttSuccessfulSmartServerResponsetSmartServerRequestOpenBzrDircB@seZd„ZRS(cC@sƒy|j|ƒ}Wntjk
r/d}nGXtƒ}y|j|ƒWn#tjtjfk
rod}nXd}t|fƒS(Ntnotyes(ttransport_from_client_pathRtPathNotChildRtprobe_transporttNotBranchErrortUnknownFormatErrorR(tselftpathtttanswert
bzr_prober((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pytdo-s
	
(t__name__t
__module__R(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR
+st SmartServerRequestOpenBzrDir_2_1cB@seZd„ZRS(cC@s”y|j|ƒ}Wntjk
r0tdƒSXytj|ƒ}Wntjk
r`d}n*Xd}|jƒr€|d7}n
|d7}t|ƒS(s_Is there a BzrDir present, and if so does it have a working tree?

        New in 2.1.
        RR(sno(sno(syes(syes(sno(RRRRRtopen_from_transportRthas_workingtree(RRRtbdR((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRDs


(RRR(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRBstSmartServerRequestBzrDircB@s,eZd„Zd„Zd„Zd„ZRS(cG@sLytj|j|ƒƒ|_Wntjk
r>}tdƒSX|j|ŒS(sBOpen a BzrDir at path, and return `self.do_bzrdir_request(*args)`.tnobranch(R"(RRRt_bzrdirRRR
tdo_bzrdir_request(RRtargste((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR^scC@s|r
dSdSdS(NRR((Rt	a_boolean((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyt_boolean_to_yes_nogscC@sC|j|jƒ}|j|jƒ}|j|jƒ}|||fS(N(R(trich_root_datatsupports_tree_referencetsupports_external_lookups(Rtrepo_formatt	rich_rootttree_reftexternal_lookup((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyt_format_to_capabilitiesmscC@sS|jj|jƒ}t|ƒr@dgt|jdƒƒ}ng}dj|ƒS(s<Get the relative path for repository from current_transport.s..t/(tuser_transporttrelpathtbasetlentsplittjoin(Rtcurrent_transportRR3tsegments((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyt
_repo_relpathus	(RRRR(R0R:(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR!\s				t%SmartServerBzrDirRequestDestroyBranchcB@seZdd„ZRS(cC@s>y|jj|ƒWntjk
r3}tdƒSXtdƒS(snDestroy the branch with the specified name.

        New in 2.5.0.
        :return: On success, 'ok'.
        R"tok(snobranch(sok(R#tdestroy_branchRRR
R(RtnameR&((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR$„s
N(RRtNoneR$(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR;‚st&SmartServerBzrDirRequestHasWorkingTreecB@seZdd„ZRS(cC@s'|jjƒrtdƒStdƒSdS(s§Check whether there is a working tree present.

        New in 2.5.0.

        :return: If there is a working tree present, 'yes'.
            Otherwise 'no'.
        RRN(syes(sno(R#RR(RR>((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR$“s
N(RRR?R$(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR@‘st)SmartServerBzrDirRequestDestroyRepositorycB@seZdd„ZRS(cC@s;y|jjƒWntjk
r0}tdƒSXtdƒS(s[Destroy the repository.

        New in 2.5.0.

        :return: On success, 'ok'.
        tnorepositoryR<(RB(sok(R#tdestroy_repositoryRtNoRepositoryPresentR
R(RR>R&((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR$£s
N(RRR?R$(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRA¡st&SmartServerBzrDirRequestCloningMetaDircB@seZd„ZRS(cC@sÔy|jjƒ}Wntjk
r/d}nX|dk	rFtdƒS|dkr[t}nt}|jjd|ƒ}|j	ƒ}|j
sµd|jƒj	ƒf}|jj	ƒ}nd}d}t
|||fƒS(	s¶Get the format that should be used when cloning from this dir.

        New in 1.13.
        
        :return: on success, a 3-tuple of network names for (control,
            repository, branch) directories, where '' signifies "not present".
            If this BzrDir contains a branch reference then this will fail with
            BranchReference; clients should resolve branch references before
            calling this RPC.
        tBranchReferencetTruetrequire_stackingRtN(RF(sbranchRI(R#tget_branch_referenceRRR?R
RGtFalsetcloning_metadirtnetwork_nametfixed_componentstget_branch_formattrepository_formatR(RRHt
branch_reftcontrol_formattcontrol_nametbranch_nametrepository_name((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR$³s(

				(RRR$(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRE±st'SmartServerBzrDirRequestCheckoutMetaDircB@seZdZd„ZRS(s¸Get the format to use for checkouts.

    New in 2.5.

    :return: on success, a 3-tuple of network names for (control,
        repository, branch) directories, where '' signifies "not present".
        If this BzrDir contains a branch reference then this will fail with
        BranchReference; clients should resolve branch references before
        calling this RPC (they should not try to create a checkout of a
        checkout).
    cC@s­y|jjƒ}Wntjk
r/d}nX|dk	rFtdƒS|jjƒ}|jƒ}|jsŽ|j	ƒjƒ}|j
jƒ}nd}d}t|||fƒS(NRFRI(sBranchReference(R#RJRRR?R
tcheckout_metadirRMRNRORPR(RRQRRRSRTt	repo_name((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR$çs

	(RRt__doc__R$(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRVÚstSmartServerRequestCreateBranchcB@seZd„ZRS(cC@s¾tj|j|ƒƒ}tjj|ƒ}||_|j|ddƒ}|j|j	j
ƒ\}}}|j
jƒ}	|j	j
jƒ}
|j|j
|j	ƒ}td|	|||||
fƒS(s®Create a branch in the bzr dir at path.

        This operates precisely like 'bzrdir.create_branch'.

        If a bzrdir is not present, an exception is propogated
        rather than 'no branch' because these are different conditions (and
        this method should only be called after establishing that a bzr dir
        exists anyway).

        This is the initial version of this method introduced to the smart
        server for 1.13.

        :param path: The path to the bzrdir.
        :param network_name: The network name of the branch type to create.
        :return: ('ok', branch_format, repo_path, rich_root, tree_ref,
            external_lookup, repo_format)
        R>RIR<(RRRRR	tgett
branch_formatt
initializeR0Rt_formatRMR:troot_transportR(RRRMtbzrdirtformattresultR-R.R/R\R,t	repo_path((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRÿs	(RRR(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRZýst"SmartServerRequestCreateRepositorycB@seZd„ZRS(c
C@s‘tj|j|ƒƒ}|dk}tjj|ƒ}||_|j|d|ƒ}|j|j	ƒ\}}}	t
d|||	|j	jƒfƒS(sôCreate a repository in the bzr dir at path.

        This operates precisely like 'bzrdir.create_repository'.

        If a bzrdir is not present, an exception is propagated
        rather than 'no branch' because these are different conditions (and
        this method should only be called after establishing that a bzr dir
        exists anyway).

        This is the initial version of this method introduced to the smart
        server for 1.13.

        :param path: The path to the bzrdir.
        :param network_name: The network name of the repository type to create.
        :param shared: The value to pass create_repository for the shared
            parameter.
        :return: (ok, rich_root, tree_ref, external_lookup, network_name)
        RGtsharedR<(RRRRR	R[RPR]R0R^RRM(
RRRMReR`RaRbR-R.R/((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR$s	(RRR(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRd"st SmartServerRequestFindRepositorycB@seZd„ZRS(cC@svtj|j|ƒƒ}|jƒ}|j|j|ƒ}|j|jƒ\}}}|jjƒ}|||||fS(sÏtry to find a repository from path upwards

        This operates precisely like 'bzrdir.find_repository'.

        :return: (relpath, rich_root, tree_ref, external_lookup, network_name).
            All are strings, relpath is a / prefixed path, the next three are
            either 'yes' or 'no', and the last is a repository format network
            name.
        :raises errors.NoRepositoryPresent: When there is no repository
            present.
        (	RRRtfind_repositoryR:R_R0R^RM(RRR`RR-R.R/RM((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyt_findEs(RRRh(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRfCst"SmartServerRequestFindRepositoryV1cB@seZd„ZRS(cC@sZy8|j|ƒ\}}}}}td|||fƒSWntjk
rUtdƒSXdS(sõtry to find a repository from path upwards

        This operates precisely like 'bzrdir.find_repository'.

        If a bzrdir is not present, an exception is propagated
        rather than 'no branch' because these are different conditions.

        This is the initial version of this method introduced with the smart
        server. Modern clients will try the V2 method that adds support for the
        supports_external_lookups attribute.

        :return: norepository or ok, relpath.
        R<RBN(snorepository(RhRRRDR
(RRR-R.R/R>((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR]s
(RRR(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRi[st"SmartServerRequestFindRepositoryV2cB@seZd„ZRS(cC@s]y;|j|ƒ\}}}}}td||||fƒSWntjk
rXtdƒSXdS(s
try to find a repository from path upwards

        This operates precisely like 'bzrdir.find_repository'.

        If a bzrdir is not present, an exception is propagated
        rather than 'no branch' because these are different conditions.

        This is the second edition of this method introduced in bzr 1.3, which
        returns information about the supports_external_lookups format
        attribute too.

        :return: norepository or ok, relpath, rich_root, tree_ref,
            external_lookup.
        R<RBN(snorepository(RhRRRDR
(RRR-R.R/R>((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRts(RRR(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRjrst"SmartServerRequestFindRepositoryV3cB@seZd„ZRS(cC@s`y>|j|ƒ\}}}}}td|||||fƒSWntjk
r[tdƒSXdS(stry to find a repository from path upwards

        This operates precisely like 'bzrdir.find_repository'.

        If a bzrdir is not present, an exception is propogated
        rather than 'no branch' because these are different conditions.

        This is the third edition of this method introduced in bzr 1.13, which
        returns information about the network name of the repository format.

        :return: norepository or ok, relpath, rich_root, tree_ref,
            external_lookup, network_name.
        R<RBN(snorepository(RhRRRDR
(RRR-R.R/R>((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRs(RRR(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRk‹st"SmartServerBzrDirRequestConfigFilecB@seZd„ZRS(cC@sC|jjƒ}|dkr$d}n|jƒjƒ}td|ƒS(s™Get the configuration bytes for a config file in bzrdir.
        
        The body is not utf8 decoded - it is the literal bytestream from disk.
        RIN((R#t_get_configR?t_get_config_filetreadR(Rtconfigtcontent((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR$¥s
	(RRR$(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRl£st#SmartServerBzrDirRequestGetBranchescB@seZd„ZRS(cC@sv|jjƒ}i}xH|jƒD]:\}}|dkrCd}nd|jjƒf||<q"Wtdtj|ƒƒS(s±Get the branches in a control directory.
        
        The body is a bencoded dictionary, with values similar to the return
        value of the open branch request.
        RIRtsuccessN(ssuccess(R#tget_branchest	iteritemsR?R^RMRR(RtbranchestretR>tb((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR$´s	(RRR$(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRr²st"SmartServerRequestInitializeBzrDircB@seZd„ZRS(cC@s,|j|ƒ}tjƒj|ƒtdƒS(s‡Initialize a bzrdir at path.

        The default format of the server is used.
        :return: SmartServerResponse(('ok', ))
        R<(sok(RRtget_default_formattinitialize_on_transportR(RRttarget_transport((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRÆs(RRR(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRyÄst$SmartServerRequestBzrDirInitializeExcB@s,eZd„Zd„Zd„Zd„ZRS(cC@s>|s
dS|dkrtS|dkr*tStd|ƒ‚dS(NRKRGsinvalid arg %r(R?RKRGtAssertionError(Rtarg((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pytparse_NoneTrueFalseÓscC@s
|p	dS(N(R?(RR((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pytparse_NoneStringÜscC@s|tkrdS|sdSdS(NRKRIRG(RK(RR((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyt_serialize_NoneTrueFalseßs
cC@sŸ|j|ƒ}tj|ƒ}|j|ƒ}|j|ƒ}|j|ƒ}|j|ƒ}|j|ƒ}|j|	ƒ}	|j|
ƒ}
|dkrŸ|j}n|j|ƒ}|j|d|d|d|d|d|d|d|	d	|
ƒ\}
}}}|
d
kr:d
}d
}d
}}}d
}d
}d
}d
}n´|j|j	|
ƒ}|d
krdd}n|j
|
jƒ\}}}|
jjƒ}|
j
jjƒ}|j}|j}|
jƒ|
jƒjpÎd
}|rä|
jƒn|
jƒ|p÷d
}|pd
}|r$tj|j|ƒ}n|jdƒrb|j|d}tj|j|ƒ}d}nt|||||||jjƒ|j|ƒ|||fƒS(sÔInitialize a bzrdir at path as per
        BzrDirFormat.initialize_on_transport_ex.

        New in 1.16.  (Replaces BzrDirFormat.initialize_ex verb from 1.15).

        :return: return SuccessfulSmartServerResponse((repo_path, rich_root,
            tree_ref, external_lookup, repo_network_name,
            repo_bzrdir_network_name, bzrdir_format_network_name,
            NoneTrueFalse(stacking), final_stack, final_stack_pwd,
            repo_lock_token))
        t.tuse_existing_dirt
create_prefixtforce_new_repot
stacked_ontstack_on_pwdtrepo_format_nametmake_working_treestshared_repoRIR1iN(RR	R[R€RR4tinitialize_on_transport_exR?R:R_R0R^RMR`t	_stack_ont
_stack_on_pwdtunlockt
lock_writetrepository_tokentleave_lock_in_placeRtrelative_urlt
startswitht_root_client_pathRR‚(Rtbzrdir_network_nameRR„R…R†R‡RˆR‰RŠR‹R|RatrepoR`tstackingtrepository_policyRcRXR-R.R/trepo_bzrdir_nametfinal_stacktfinal_stack_pwdtrepo_lock_tokentclient_path((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRæsl				


		(RRR€RR‚R(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR}Ñs				tSmartServerRequestOpenBranchcB@seZd„ZRS(cC@s]y9|jjƒ}|dkr(tdƒStd|fƒSWntjk
rX}tdƒSXdS(s@open a branch at path and return the branch reference or branch.R<RIR"N(sokRI(snobranch(R#RJR?RRRR
(Rt
reference_urlR&((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR$7s
(RRR$(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyRŸ5stSmartServerRequestOpenBranchV2cB@seZd„ZRS(cC@s‡yc|jjƒ}|dkrR|jjdtƒ}|jjƒ}td|fƒStd|fƒSWntj	k
r‚}t
dƒSXdS(s9open a branch at path and return the reference or format.tignore_fallbacksRtrefR"N(snobranch(R#RJR?topen_branchRGR^RMRRRR
(RR tbrRaR&((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR$Es(RRR$(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR¡CstSmartServerRequestOpenBranchV3cB@seZd„ZRS(cC@sÒyc|jjƒ}|dkrR|jjdtƒ}|jjƒ}td|fƒStd|fƒSWnhtj	k
rÍ}t
|ƒd}|j}|rÃ|jdƒr³|d}n||f7}nt
|ƒSXdS(	s’Open a branch at path and return the reference or format.
        
        This version introduced in 2.1.

        Differences to SmartServerRequestOpenBranchV2:
          * can return 2-element ('nobranch', extra), where 'extra' is a string
            with an explanation like 'location is a repository'.  Previously
            a 'nobranch' response would never have more than one element.
        R¢RR£R"s: iN(snobranch(R#RJR?R¤RGR^RMRRRtstrtdetailR”R
(RR R¥RaR&trespR¨((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR$Us 

	
(RRR$(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyR¦SsN((RYt
__future__RtbzrlibRRRRRt
bzrlib.bzrdirRRRtbzrlib.controldirR	tbzrlib.smart.requestR
RRR
RR!R;R@RARERVRZRdRfRiRjRkRlRrRyR}RŸR¡R¦(((s7/usr/lib/python2.7/dist-packages/bzrlib/smart/bzrdir.pyt<module>s4(&)#%!
d

Copyright © 2017 || Recoded By Mr.Bumblebee