-=[ Mr. Bumblebee ]=-
_Indonesia_

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


Nc@@s^ddlmZddlmZddlZddlZddlmZmZm	Z	m
Z
mZmZm
ZmZmZmZmZddlmZmZddlmZddlmZdejfd	YZd
efdYZdefd
YZdejfdYZ defdYZ!defdYZ"defdYZ#dS(i(tabsolute_import(tStringION(terrorstiterablefilet	lru_cachetmultiparenttosutilstpacktrevisiont
serializerttracetuit
versionedfile(tbundle_dataR	(tngettext(tbencodet_MPDiffInventoryGeneratorcB@s eZdZdZdZRS(s0Generate Inventory diffs serialized inventories.cC@s2tt|j|j|||_i|_dS(N(tsuperRt__init__tinventoriestrepotsha1s(tselfRtinventory_keys((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyR,s	cc@s2|jg|jD]}|d^q}|jg|jD]}|d^q:|jjj}x|jj|D]}|j}|f}||jkrd}n$g|j
|D]}|d^q}||}|j||f|dkrqsn|jj
|}	tj|}
|||
|	fVqsWdS(s Compute the diffs one at a time.iN(t_find_needed_keystpresent_parentstextendtordered_keysRt_serializertwrite_inventory_to_stringtiter_inventoriestrevision_idtNonet
parent_mapt_process_one_recordtdiffstpopRt
sha_string(Rtkt
needed_idst
inv_to_strtinvRtkeyt
parent_idstas_bytestdifftsha1((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyt
iter_diffs2s"
 '			$(t__name__t
__module__t__doc__RR/(((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyR)s	tBundleWritercB@sheZdZdZdZdZdZdZdZdZ	e
d
dZd	Z
RS(sWriter for bundle-format files.

    This serves roughly the same purpose as ContainerReader, but acts as a
    layer on top of it.

    Provides ways of writing the specific record types supported this bundle
    format.
    cC@s1tj|j|_||_tj|_dS(N(RtContainerWritert_write_encodedt
_containert_fileobjtbz2t
BZ2Compressort_compressor(Rtfileobj((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRXs	cC@s |jj|jj|dS(s%Write bzip2-encoded bytes to the fileN(R7twriteR:tcompress(Rtbytes((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyR5]scC@s=|jjtjtj|jjd|jjdS(sStart writing the bundles#
N(R7R<tbundle_serializert_get_bundle_headert	v4_stringR6tbegin(R((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRBas
cC@s*|jj|jj|jjdS(sFinish writing the bundleN(R6tendR7R<R:tflush(R((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRChs
cC@s8i|d6dd6|d6}|j|||||dS(sAdd a record for a multi-parent diff

        :mp_bytes: A multi-parent diff, as a bytestring
        :sha1: The sha1 hash of the fulltext
        :parents: a list of revision-ids of the parents
        :repo_kind: The kind of object in the repository.  May be 'file' or
            'inventory'
        :revision_id: The revision id of the mpdiff being added.
        :file_id: The file-id of the file, or None for inventories.
        tparentstmpdifftstorage_kindR.N(t_add_record(Rtmp_bytesR.REt	repo_kindRtfile_idtmetadata((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pytadd_multiparent_recordms

cC@s?i|d6dd6}|j|i|d6dd6||ddS(s6Add a record for a fulltext

        :bytes: The fulltext, as a bytestring
        :parents: a list of revision-ids of the parents
        :repo_kind: The kind of object in the repository.  May be 'revision' or
            'signature'
        :revision_id: The revision id of the fulltext being added.
        RERFRGtfulltextN(RHR (RR>RERJRRL((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pytadd_fulltext_record~s	

cK@s'd|d<|jd|ddddS(sAdd an info record to the bundle

        Any parameters may be supplied, except 'self' and 'storage_kind'.
        Values must be lists, strings, integers, dicts, or a combination.
        theaderRGtinfoN(RHR (Rtkwargs((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pytadd_info_records
cC@s|dkrt|n|dkrB|d	krZtqZn|d	k	rZtn|dkr|d	k	rtqn|d	krtng|||fD]$}|d	k	r|jdd^q}dj|S(
s'Encode semantic ids as a container nameRtfilet	inventoryt	signatureRQt/s//(srevisionsfileRURVsinfoN(t
ValueErrorR tAssertionErrortreplacetjoin(tcontent_kindRRKtntnames((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pytencode_names 	7cC@sg|j|||}tj|}|jj||fg|ddkrc|jj|gndS(sAdd a bundle record to the container.

        Most bundle records are recorded as header/body pairs, with the
        body being nameless.  Records with storage_kind 'header' have no
        body.
        RGRPN(R_RR6tadd_bytes_record(RR>RLRJRRKtnametencoded_metadata((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRHs
N(R0R1R2RR5RBRCRMRORStstaticmethodR R_RH(((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyR3Ns								tBundleReadercB@sAeZdZedZedZedZdZRS(sReader for bundle-format files.

    This serves roughly the same purpose as ContainerReader, but acts as a
    layer on top of it, providing metadata, a semantic name, and a record
    body
    cC@sw|j}|dkr%|jng|_|rOtj|j|}nttj|j}||_	dS(sConstructor

        :param fileobj: a file containing a bzip-encoded container
        :param stream_input: If True, the BundleReader stream input rather than
            reading it all into memory at once.  Reading it into memory all at
            once is (currently) faster.
        s
N(
treadlinetpatch_linesRtIterableFiletiter_decodeRR8t
decompresstreadt_container_file(RR;tstream_inputtlinetsource_file((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRs
	cc@sHtj}x5|D]-}y|j|VWqtk
r?dSXqWdS(s-Iterate through decoded fragments of the fileN(R8tBZ2DecompressorRitEOFError(R;tdecompressorRm((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRhs

cC@stjd|}dg}xY|D]Q}|dkrG|dcd7<q"|dkrc|jdq"|dc|7<q"W|d}d	}d	}t|dkr|d}nt|dkr|d}n|||fS(
sxDecode a name from its container form into a semantic form

        :retval: content_kind, revision_id, file_id
        s(//?)ts//iRWiiiN(tretsplittappendR tlen(RatsegmentsR^tsegmentR\RRK((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pytdecode_names 	



cc@stj|j}x|D]\}}t|dkrStjdt|ntj|}|ddkr{d}n|j	\}}||f|j
|ddVqWdS(sIterate through bundle records

        :return: a generator of (bytes, metadata, content_kind, revision_id,
            file_id)
        is Record has %d names instead of 1RGRPiN(Rtiter_records_from_fileRkRvRt	BadBundleRtbdecodeR tnextRy(RtiteratorR^R>RLt_unused((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pytiter_recordss		(	R0R1R2tTrueRRcRhRyR(((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRds

tBundleSerializerV4cB@s8eZdZdZdZdZedZRS(s)Implement the high-level bundle interfacecC@s"tj||||}|jS(sWWrite a bundle to a file-like object

        For backwards-compatibility only
        (tBundleWriteOperationt
from_old_argstdo_write(Rt
repositorytrevision_idstforced_basesR;twrite_op((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyR<
scC@st||||}|jS(sGWrite a bundle to a file object

        :param repository: The repository to retrieve revision data from
        :param target: The head revision to include ancestors of
        :param base: The ancestor of the target to stop including acestors
            at.
        :param fileobj: The file-like object to write to
        (RR(RRttargettbaseR;R((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pytwrite_bundles	cC@st||}|S(s'return a reader object for a given file(tBundleInfoV4(RRTtbundle((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRjscC@stjj|dS(s/Retrieve the serializer for a given info objectR	(R	tformat_registrytget(RQ((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pytget_source_serializer$s(R0R1R2R<RRjRcR(((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRs
				RcB@sweZdZedZddZdZdZdZ	dZ
dZdZe
d	Zd
ZRS(s6Perform the operation of writing revisions to a bundlecC@s1|j|||\}}t|||||S(s6Create a BundleWriteOperation from old-style arguments(tget_base_targetR(tclsRRRR;RR((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyR-scC@s||_||_||_t|}||_|dk	rH||_nX|j}|j||g}|j	|}g|D]}	|	|kr|	^q|_t
g|jD]}
|
f^q|_dS(N(RRRR3RR Rt	get_graphtfind_unique_ancestorstget_parent_maptsett
revision_keys(RRRRR;RRtgraphREtrtrevid((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyR5s				(cC@stjtddt|jt|j|jjz<|jj|j	|j
|j|jjWd|jj
X|jS(sWrite all data to the bundlesBundling %d revision.sBundling %d revisions.N(R
tnoteRRvRRt	lock_readRRBt
write_infotwrite_filestwrite_revisionsRCtunlock(R((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyREs




cC@sM|jj}idt6dt6|jj}|jjd|d|dS(sWrite format infoiiR	tsupports_rich_rootN(Rtget_serializer_formatRtFalseRRRS(Rtserializer_formatR((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRTs
cC@syg}|jj|j}x>|jD]0\}}x!|D]}|j||fq;Wq(W|jd|jj|dS(s3Write bundle records for all revisions of all filesRTN(Rtfileids_altered_by_revision_idsRt	iteritemsRut_add_mp_records_keysttexts(Rt	text_keystaltered_fileidsRKRR((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyR\s	
cC@s|jj}gtj||jD]}|d^q"}|}|jdk	r|j|jkrt|}|j	|j|j
|jn|jjjr|j
d|g|D]}|f^qn
|j||j|dS(s5Write bundle records for all revisions and signaturesiRUN(RRRttopo_iter_keysRRR RtlisttremoveRuRtsupport_altered_by_hackRt&_add_inventory_mpdiffs_from_serializert_add_revision_texts(Rtinv_vfR*ttopological_ordertrevision_orderR((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRfs	#! 
c
C@sg|D]}|f^q}t|j|}xT|jD]F\}}}}dj|j}	|jj|	||d|dq;WdS(sGenerate mpdiffs by serializing inventories.

        The current repository only has part of the tree shape information in
        the 'inventories' vf. So we use serializer.write_inventory_to_string to
        get a 'full' representation of the tree shape, and then generate
        mpdiffs on that data stream. This stream can then be reconstructed on
        the other side.
        RrRUN(RRR/R[tto_patchRRMR (
RRRtinventory_key_ordert	generatorRR+R.R-ttext((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyR~s			c	C@s|jj|}|jjj}|jj|}x|D]}|j}|j|d}||}|jj	||d|y)|jj	|jj
||d|Wq:tjk
rq:Xq:WdS(NRRV(
RRRtwrite_revision_to_stringt
get_revisionsRRR RROtget_signature_textRtNoSuchRevision(	RRR!trevision_to_strt	revisionsRRREt
revision_text((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRs
	
		cC@st|dkrdS|d}|j|}|dkrx|j|j}t|dkrktj}qx|d}n||fS(s9Determine the base and target from old-style revision idsiN(NN(RvR Rtget_revisionR+t
_mod_revisiont
NULL_REVISION(RRRRRRE((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRs

cC@sttj||}|j|}|j|}|j|}xt||D]\}}	||	}
g||	D]}|d^qv}dj|j}
t	|	dkr|	d}nd}|jj|
|
|||	d|qUWdS(s)Add multi-parent diff records to a bundleiRriiN(
RRRtmake_mpdiffst	get_sha1sRtzipR[RRvR RRM(RRJtvftkeysRtmpdiffsRR!RFtitem_keyR.R*RERRK((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRs
!
N(R0R1R2tclassmethodRR RRRRRRRRcRR(((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyR*s			
			RcB@seZdZdZdZedZdZedZdZ	e
e	ZdZe
eZ
dZe
eZRS(	s*Provide (most of) the BundleInfo interfacecC@s(||_||_d|_d|_dS(N(R7RR t_BundleInfoV4__real_revisionst_BundleInfoV4__revisions(RR;R	((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRs			cC@s
|j|S(N(tinstall_revisions(RR((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pytinstallscC@sH|jz,t|j||j|}|jSWd|jXdS(s=Install this bundle's revisions into the specified repository

        :param target_repo: The repository to install into
        :param stream_input: If True, will stream input rather than reading it
            all into memory at once.  Reading it into memory all at once is
            (currently) faster.
        N(t
lock_writetRevisionInstallertget_bundle_readerRRR(RRRltri((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRs
cC@sd|jdfS(s}Provide data for performing a merge

        Returns suggested base, suggested target, and patch verification status
        tinapplicableN(R R(Rttarget_repo((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pytget_merge_requestscC@s |jjdt|j|S(sReturn a new BundleReader for the associated bundle

        :param stream_input: If True, the BundleReader stream input rather than
            reading it all into memory at once.  Reading it into memory all at
            once is (currently) faster.
        i(R7tseekRd(RRl((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRsc	C@s|jdkrg|_|j}xu|jD]d\}}}}}|dkrg|jj|}n|dkr1|j|}|jj|q1q1Wn|jS(NRQR(RR RRRRtread_revision_from_stringRu(	Rt
bundle_readerR>RLRJRRKR	trev((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyt_get_real_revisionss	cC@sR|jdkrKg|_x0|jD]"}|jjtjj|q"Wn|jS(N(RR treal_revisionsRuR
tRevisionInfot
from_revision(RR((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyt_get_revisionss		cC@s|jdjS(Ni(RR(R((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyt_get_targets(R0R1R2RRRRRRRtpropertyRRRRR(((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRs			
	
		RcB@sqeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
RS(s$Installs revisions into a repositorycC@s(||_||_||_d|_dS(N(R6Rt_repositoryR t_info(Rt	containerR	R((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRs			cC@sH|jjy|j}Wn|jjnX|jj|S(sVPerform the installation.

        Must be called with the Repository locked.
        (Rtstart_write_groupt_install_in_write_grouptabort_write_grouptcommit_write_group(Rtresult((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRs


c
C@sd}d}g}d}g}t}d}xu|jjD]d\}}	}
}}|
dkr|jdk	rytn|j|	n|r|
|fd|fkr|j|jj	|d}|2nt
|dkr|
dkr|j|g}n|
dkr&|j|f|	|fn|
dkrN|}|j
||	|n|
dkrp|j||	|n|
dkr=|}|j||f|	|fq=q=W|j|jj	||S(NRQRTiRURRV(R RR6RRRYt_handle_infot_install_mp_records_keysRRRvt_install_inventory_recordsRut_install_revisiont_install_signature(
Rtcurrent_filetcurrent_versionedfiletpending_file_recordstinventory_vftpending_inventory_recordst	added_invttarget_revisionR>RLRJRRK((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyR%sD	"
	#cC@sV||_|jj||_|ddkrI|jjrIt|_n	t|_dS(s Extract data from an info recordRiN(	RRRt_source_serializerRRRtupdate_rootR(RRQ((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRKs	cC@s{t|dkrdStjj}g|D];\}}}||kr)||d|d||f^q)}|j|dS(NiRER.(RvRtMultiParentt
from_patchtadd_mpdiffs(RRtrecordstd_funcRtmttt
vf_records((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyt_install_mp_recordsUsEcC@stjj}g}x|D]{\}}}t|dkrG|d }nd}g|dD]}	||	f^qX}
|j||
|d||fqW|j|dS(NiiRER.((RRRRvRuR(RRRRRR*tmetaRtprefixtparentRE((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyR]s
$'cC@sji}g}xF|D]>}|j|d}|dkrG|j|q|||<qWd}|r=g|D]}	|	f^qh}
|jjj|
}g}t}x:|D]2}
|
f|kr|j|
q|j|
qW|jj	}xP|jj
|D]9}||}|||j<|||j<|||j<qWng|D]}||krD||^qD}|S(N((RR RuRRRRtaddRRRR(Rtinventory_text_cachetinventory_cacheR+tcached_parent_textstremaining_parent_idst	parent_idtp_texttghostsRtparent_keystpresent_parent_maptpresent_parent_idstp_idt	to_stringt
parent_invtparent_texts((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyt_get_parent_inventory_textsns:
		




cC@s/|jd|jjjkrA|jjjrA|j|jj|Stjd}tj	d}t
jj}zt
|}xt|D]\}\}}}	|jd|||d}
|d}|j|||}tjj|	j|}
dj|
}~
tj|}||dkr9tjd	n|||
<|jj|}|j||d}|r|j|d
d}nyU|dkr|jj|
||n,|j |}|jj!|d
||
|Wn,tj"k
r
tj#t$|jnX|||
<qWWd|j%XdS(
NR	i
isinstalling inventoryiRERrR.sCan't convert to target formatii(i(&RRRt
format_numRRRRtLRUSizeCachetLRUCacheRt
ui_factorytnested_progress_barRvt	enumeratetupdateRRRRtto_linesR[RR%RR{Rtread_inventory_from_stringt_handle_rootR Rt
add_inventoryt_make_deltatadd_inventory_by_deltatUnsupportedInventoryKindtIncompatibleRevisiontreprtfinished(RRRRtpbtnum_recordstidxR*RLR>RR+tp_textsttarget_linestinv_textR.t
target_invRtdelta((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRsR"

			
		
cC@s|j}|jre|jj|f}g|D]}|jj|f^q+}|jjj||gn?|jjs|jj|krt	j
t|jqndS(N(RRtrootRKRRt	add_linesRRRR!R"(RR*R+Rttext_keyRR((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRs		"cC@sB|jj|rdS|jj|}|jj|j|dS(N(Rthas_revisionRRtadd_revisionR(RRRLRR((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRscC@s<|jj}|jj|r%dS|jj||dS(N(Rtget_transactionthas_signature_for_revision_idtadd_signature_text(RRRLRttransaction((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRs(R0R1R2RRRRRRRRRRR(((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyRs			&	
			(	;		($t
__future__Rt	cStringIORR8RstbzrlibRRRRRRRRR	R
RRt_mod_versionedfilet
bzrlib.bundleR
R?tbzrlib.i18nRRt_MPDiffGeneratorRtobjectR3RdtBundleSerializerRRRR(((s?/usr/lib/python2.7/dist-packages/bzrlib/bundle/serializer/v4.pyt<module>sL
%jO#L

Copyright © 2017 || Recoded By Mr.Bumblebee