-=[ Mr. Bumblebee ]=-
_Indonesia_

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


;Pc@@sdZddlmZddlZddlmZmZmZmZm	Z	m
ZmZm
Z
mZmZmZmZmZddlmZmZddlmZddlmZmZddlmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%dd	l&m'Z'dd
l(m)Z)defdYZ*d
e$fdYZ+de%fdYZ,de,fdYZ-de,fdYZ.de"fdYZ/de fdYZ0de'fdYZ1de2fdYZ3dZ4dZ5de#fd YZ6d!e6fd"YZ7dS(#sGRepository formats using CHK inventories and groupcompress compression.i(tabsolute_importN(
t
controldirtchk_maptchk_serializertdebugterrorstindext	inventorytosutilstpacktrevisionttracetuit
versionedfile(tBTreeGraphIndextBTreeBuilder(tneeds_write_lock(t
_GCGraphIndextGroupCompressVersionedFiles(	t_DirectPackAccesstPacktNewPacktPackRepositorytPackRootCommitBuildertRepositoryPackCollectiontRepositoryFormatPacktResumedPacktPacker(tStreamSource(tStaticTupletGCPackcB@s eZdddZdZRS(tc	@s|j}|jd
k	r*|dd}nd
}tj|dd|dd|dddd|ddd||_|j_|j_	|j
_|j_
|_tj_d
_d_tjd|_tj_j	jjdj_d	tjkritjd
tjj	jjtjjngdg_ t!j jj"jj#fd}|_$t%j&j$_'j'j(d_)d
_*d
S(sdCreate a NewPack instance.

        :param pack_collection: A PackCollection into which this is being
            inserted.
        :param upload_suffix: An optional suffix to be given to any temporary
            files created during the pack creation. e.g '.autopack'
        :param file_mode: An optional file mode to create the new files with.
        treference_listsiitkey_elementsit	chk_indexitmodeR	s0%s: create_pack: pack stream open: %s%s t+%6.3fsc@s{|dj||dct|7<|djks@|rwdj|d}||||gdg|(ndS(NiiR(tappendtlent_cache_limittjoin(tbytestflusht_buffert_writet_update(tself(sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_write_datas

topenN(+t_index_builder_classR"tNoneRt__init__t_pack_collectiont_index_classtindex_classt_upload_transporttupload_transportt_index_transporttindex_transportt_pack_transporttpack_transportt
_file_modeRtmd5t_hashtindex_sizesR&t
rand_charstrandom_namettimet
start_timetopen_write_streamtwrite_streamRtdebug_flagsRtmuttertctimetbaseR*tFalsetwritetupdateR.R	tContainerWritert_writertbegint_statetname(R-tpack_collectiont
upload_suffixt	file_modetindex_builder_classR"R.((R-sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR2BsF									!
	
	cC@sdS(sBMake sure our external references are present.

        Packs are allowed to have deltas whose base is not in the pack, but it
        must be present somewhere in this collection.  It is not allowed to
        have deltas based on a fallback repository.
        (See <https://bugs.launchpad.net/bzr/+bug/288751>)
        N((R-((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_check_referencessN(t__name__t
__module__R1R2RV(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR@sdt
ResumedGCPackcB@seZdZdZRS(cC@sdS(s7Make sure our external compression parents are present.N((R-((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRVscC@stS(N(tset(R-R((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_get_external_refss(RWRXRVR[(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRYs	tGCCHKPackercB@seZdZdddZdZddZddZedZ	dZ
dZdZd	Z
d
ZdZdZd
ZdZRS(s<This class understand what it takes to collect a GCCHK repo.cC@stt|j|||d|d|||_|jdkrOtdnt|_g|_	g|_
d|_d|_dS(Ntrevision_idstreload_funcs,pack_collection.chk_index should not be None(
tsuperR\R2R3R"R1tAssertionErrorRJt_gather_text_refst
_chk_id_rootst_chk_p_id_rootst
_text_refst
revision_keys(R-RRtpackstsuffixR]R^((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR2s					c@sfd}|S(Nc3@sgjdt}xKt|D]=\}}dk	rZj|dtn|Vq"WdS(Nt
groupcompressi(tget_record_streamtTruet	enumerateR1RLR%(t	substreamtidxtrecord(tkeystmessagetpbt	source_vf(sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt	pb_streams
 ((R-RrRoRpRqRs((RoRpRqRrsE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_get_progress_streamsc@s.tfd}|S(s7Filter the texts of inventories, to find the chk pages.c	3@sDt}t}jdt}xt|D]\}}|jd}tjjd||j	}dk	rj
d|n|jj	}||krjj
||j|n|j}|dkrtdn|j	}||kr#|j|jj
|n|Vq4W|j|jdS(NRhtfulltexttinvs Parent id -> file_id map not set(RZRiRjRktget_bytes_asRtCHKInventorytdeserialiseR1tkeyRLtid_to_entryRbR$taddtparent_id_basename_to_file_idR`Rctclear(	tid_roots_settp_id_roots_settstreamRmRnR(tchk_invRztp_id_map(RoRqR-Rrt
total_keys(sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_filtered_inv_streams.			
	
(R%(R-RrRoRpRqR((RoRqR-RrRsE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_get_filtered_inv_streamsc#@s$t|t|dgjr9t_ntfd}x"|jjD]}|VqpW`gjD]}|kr|^q}`x||tD]}|VqWr tjdtj	dkr jdt}|Vq ndS(Nic3@s|xrijtfd	fd
fd}|Vgx*tD]}jj|qWq	WdS(Nc@sex^|jjD]M\}}|kr|krj|gj|j|qqWdS(N(t_itemst	iteritemst
setdefaultR$R|(tnodetprefixtvalue(tkeys_by_search_prefixt	next_keystremaining_keys(sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pythandle_internal_nodes

	c@s=x6|jdD]%\}}jjtj|qWdS(N(RR1RdR|Rt_bytes_to_text_key(Rtfile_idR((R-(sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pythandle_leaf_node%sc3@sjdt}x|D]}|jdkr7qn|jd}tj||jdd}|j}t	|tj
r|nr|ndcd7<dk	rjddn|VqWdS(Nsas-requestedtabsentRutsearch_key_funciischk node(RiRjtstorage_kindRwRt_deserialiseRzR1t_search_prefixt
isinstancetInternalNodeRL(RRnR(Rtcommon_base(tcountertcur_keysRRtparse_leaf_nodesRqRrR(sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pytnext_stream*s"	
		

(tdifference_updateRZtsortedtextendtpop(t	root_keysRRR(RRqRR-RrR(RRRRRRsE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_get_referenced_streams	
	$	sDThere were %d keys in the chk index, %d of which were not referencedt	unordered(
R%RZRaRdRJRbRcRRGR]R1RiRj(R-RrRoRqRRRztchk_p_id_roots((RRqRR-RrRsE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_get_chk_streamss.		!=			
	c
	C@sD|d}i}t|d|j}|r|jd
krItdnt|j|}|jj||<|jdt|j	|jj
||jj|j}n[g}	x=|jD]2}
t|
|}|
j||<|	j
|qWtj|	}d
}tt|d|d|d|jjjd|d	|}|S(s>Build a VersionedFiles instance on top of this group of packs.t_indexR^sNo new pack has been settfor_sizetadd_callbacktparentst	is_lockedtaccesstdeltaN(Rt_reload_functnew_packR1R`tgetattrtaccess_tupletset_optimizeRjt
set_writerRNt	add_nodesRfR$t
_mod_indextCombinedGraphIndexRRR3trepoR(
R-t
index_nameRRt	for_writet
index_to_packRRRtindicesR	t	sub_indextvf((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt	_build_vfcs8
			cC@s@|j|||dt}|j|||dt}||fS(s+Build the source and target VersionedFiles.R(RRJRj(R-RRRRrt	target_vf((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt
_build_vfss
c
C@stjdt|||jjd|f|tjj}z?|||||}x#|j|dt	dt
D]}	qvWWd|jXdS(Nsrepacking %d %ssrepacking %st	random_idtreuse_blocks(RRGR%RqRLRt
ui_factorytnested_progress_bart_insert_record_streamRjRJtfinished(
R-RrRRoRptvf_to_streamt	pb_offsettchild_pbRt_((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_copy_streams
cC@s\|jdtt\}}|js6|j|_n|j|||jd|jddS(NR
t	revisionsi(RRjRJReRoRRt(R-RrR((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_copy_revision_textss
	cC@s|jdtt\}}|j}t|jj|}|r|jjjj	}|j
|}|j|}|rt|}td|fqn|j
|||d|jddS(NRs,We are missing inventories for revisions: %stinventoriesi(RRjRoRZRet
differenceR3RRRtget_parent_mapRt
ValueErrorRR(R-RrRtinventory_keystmissing_inventoriest	inv_indextpmaptreally_missing((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_copy_inventory_textsscC@s|jdttS(Ntchk(RRJ(R-((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_get_chk_vfs_for_copyscC@s|j\}}|j}tjdt|jt|jt||jjddt	j
j}zMxF|j||d|D],}x#|j
|dtdtD]}qWqWWd|jXdS(NsErepacking chk: %d id_to_entry roots, %d p_id_map roots, %d total keyss
repacking chkiRqRR(RRoRRGR%RbRcRqRLRRRRRRjRJR(R-RrRRRRR((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_copy_chk_textss	


cC@sJ|jdtt\}}|j}|j|||d|jddS(Nttextttextsi(RRjRoRRt(R-RrRt	text_keys((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_copy_text_textsscC@sZ|jdtt\}}|j}|j|j|j|||d|jddS(Nt	signaturet
signaturesi(RRJRotintersectionReRRt(R-RrRtsignature_keys((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_copy_signature_textss
cC@sE|jjddd|j|_|jjd	|j|j|j|j|j	|jj
|j|js|jjdS|jjt|jdkr|jd}|j|jjjkrtjd|j|jjdSn|jjddd|jj|jj|j|jS(
Nt	repackingiiiis+single pack %s was already optimally packedsfinishing repackii(RqRLt	open_packRtset_write_cache_sizeRRRRRRVt	_use_packtabortR1tfinish_contentR%RfRQR>t	hexdigestRRGtfinishR3tallocate(R-told_pack((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_create_pack_from_packss0








	


N(RWRXt__doc__R1R2RtRRRJRRRRRRRRRR(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR\s 		 h!								tGCCHKReconcilePackercB@s2eZdZdZdZdZdZRS(sA packer which regenerates indices etc as it copies.

    This is used by ``bzr reconcile`` to cause parent text pointers to be
    regenerated.
    cO@s/tt|j||t|_t|_dS(N(R_RR2RJt
_data_changedRjRa(R-targstkwargs((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR2	s	cC@sb|jdtt\}}|j|||jd|jd|j|jkr^t|_ndS(NRRi(RRjRReRRoR(R-RrR((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRs
c@sjdtt\}tjdtjjjddjj	}j
dttdt}|j|j
}td|jD}~|jd	|}jj}g}ig}	tj}
xjD]}yt||}Wn'tk
r.|	j|t_qX||
fkrGd
}n||}
||
krm|j|qt_||<qW~~fd}|j|d	S(s1generate what texts we should have and then copy.Rsrepacking %d textssrepacking textsiR
Rcs@sB|]8\}}|dtg|D]}|d^q fVqdS(iN(ttuple(t.0tkRtp((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pys	<genexpr>!sc3@sTjjdt}x5|D]-}|jkrG|j|_n|VqWdS(NRh(RiRdRJRzR(RRn(tnew_parent_keysR-Rr(sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_update_parents_for_textsIs
N((RRjRRGR%RdRqRLR3RRRJRRotdictRt_generate_text_key_indexR1t
_mod_revisiont
NULL_REVISIONRtKeyErrorR$Rtinsert_record_stream(R-RRtrevision_vft
ancestor_keyst	ancestorstideal_indextfile_id_parent_maptok_keystdiscarded_keysRRzt
ideal_parentstsource_parentsR((RR-RrsE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRs@		


	
	cC@s|jo|jS(sAOverride _use_pack to check for reconcile having changed content.(t
data_insertedR(R-R((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRRs(RWRXRR2RRR(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRs
			=tGCCHKCanonicalizingPackercB@sMeZdZdZdZdZdZddddZdZ	RS(sA packer that ensures inventories have canonical-form CHK maps.
    
    Ideally this would be part of reconcile, but it's very slow and rarely
    needed.  (It repairs repositories affected by
    https://bugs.launchpad.net/bzr/+bug/522637).
    cO@s&tt|j||t|_dS(N(R_RR2RJR(R-RR((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR2_scC@sX|jjd|f|tjj}zt|||||Wd|jXdS(sCreate and exhaust a stream, but don't insert it.

        This is useful to get the side-effects of generating a stream.
        sscanning %sN(RqRLRRRtlistR(R-RrRoRpRRR((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_exhaust_streamcs
c@sjdtt\}}j\|j}j||djdtjdfd}j	|||d|ddS(NRRic@sj||||S(N(t'_get_filtered_canonicalizing_inv_stream(RrRoRpRq(R-t
source_chk_vft
target_chk_vf(sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pytchk_canonicalizing_inv_stream}si(
RRjRRoRRR\RR1R(R-RrRRR((R-RRsE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRos

cC@sdS(N((R-((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRsc@sCttjfd}|S(sdFilter the texts of inventories, regenerating CHKs to make sure they
        are canonical.
        c3@sjdt}d}xt|D]\}}|jd}tjj||j}dk	rj	d|n|j
j|dkrtj
}x3|jD]"\}}||j
jkrPqqWntjj|d|j
jjd|}|j
j|j
jkrctjd|j|j
jd|j
jdft_n|j}	|	j|j}
|	j|
jkrtjd|j|	jd|
jdft_ntj|j|j|j|jVq(WdS(	NRhRuRvtmaximum_sizetsearch_key_namesKNon-canonical CHK map for id_to_entry of inv: %s (root is %s, should be %s)isUNon-canonical CHK map for parent_id_to_basename of inv: %s (root is %s, should be %s)(RiRjR1RkRwRRxRyRzRLR{t_ensure_rootRtsearch_key_registryRt_search_key_functfrom_inventoryt
_root_nodet
_maximum_sizeRRGtrevision_idRR}R
tChunkedContentFactoryRtsha1tto_lines(RRRmRnR(Rtsearch_key_regtfunct
canonical_invRtcanon_p_id_map(RoRqR-RRrRR(sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRsJ	
					
	(R%R
tNoDupeAddLinesDecorator(R-RrRoRpRqRRR((RoRqR-RRrRRsE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRs!+cC@s|jo|jS(sAOverride _use_pack to check for reconcile having changed content.(RR(R-R((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRsN(
RWRXRR2RRRR1RR(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRWs				3tGCRepositoryPackCollectioncB@s)eZeZeZeZeZdZ	RS(cC@sg}|jjjj}|j}|jjj}|jjj}|jjj}|j|}t	|}t	|}	|	j
||	r|jdt|	f|St	|}
x!|j
D]}|
j|qW|
j|j|
|
j|}t	}
g|
D]}|d^q}g|D]}|d^q+}t|j||}|j}|j|}|j|}|r|jdt|f|S|jjj}|jjj|_tj||j|j}t	}y$xt||tjD]}qWWn#tjk
r5}|jdnXtj||j|j}yx|D]\}}q[WWn#tjk
r}|jdnX|j|}|j|}|r|jdt|fn|S(sDetect missing inventories or chk root entries for the new revisions
        in this write group.

        :returns: list of strs, summarising any problems found.  If the list is
            empty no problems were found.
        s$inventories missing for revisions %sishmissing referenced chk root keys: %s.Run 'bzr reconcile --canonicalize-chks' on the affected repository.s(missing chk node(s) for id_to_entry mapss:missing chk node(s) for parent_id_basename_to_file_id mapssmissing text keys: %r( RRRt_key_dependenciestget_new_keysRt	chk_bytesRRRZRR$Rt
itervaluesRLtintersection_updatetsymmetric_differencet_build_interesting_key_setstall_keysRtwithout_fallbacksRRtiter_interesting_nodestinteresting_root_keystuninteresting_root_keyst_filter_text_keysRRtNoSuchRevisiontinteresting_pid_root_keystuninteresting_pid_root_keys(R-tproblemstkey_depstnew_revisions_keystno_fallback_inv_indextno_fallback_chk_bytes_indextno_fallback_texts_indextinv_parent_maptcorresponding_invstmissing_correspondingtall_inv_keystparent_inv_keystparent_invs_only_keystall_missingRztinv_idstparent_invs_only_idst
root_key_infotexpected_chk_rootstpresent_chk_rootstmissing_chk_rootstchk_bytes_no_fallbackstchk_diffRRntetinteresting_rectinteresting_maptpresent_text_keystmissing_text_keys((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_check_new_inventoriess~
	
								(
RWRXRtpack_factoryRYtresumed_pack_factoryR\tnormal_packer_classtoptimising_packer_classRO(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR$s
tCHKInventoryRepositorycB@seZdZdZdZdZdedZdZ	dZ
dZdZdd	Z
d
ZedZdZd
ZdZddZdZRS(s;subclass of PackRepository that uses CHK based inventories.c	
C@stt|j||||||jjd}t||j||jjd|jjd|j|jd|jj	|_
tt|j
j
jd|j
j
jdtd|jdtd	|j
j
j|_tt|j
jjd|j
jjdtd|jd
tdtd	|j
jjdt|_tt|j
jjd|j
jjdtd|jdtd	|j
jjdt|_tt|j
jjd|j
jjdtd|jdtd	|j
jj|_tt|j
jjd|j
jjdtd|jdtd	|j
jj|_|jjj}tj j!|}||j_"d
|_#d|_%t|_&t|_'t|_(dS(s+Overridden to change pack collection class.RtuploadRft
use_chk_indexRRRtinconsistency_fatalRttrack_external_parent_refsttrack_new_keysRiN()R_RTR2t
_transporttcloneR$RUR5t_formatt
supports_chksR3RRtinventory_indextcombined_indexRRjRRJtdata_accessRtrevision_indexRtsignature_indexRt
text_indexRR"R't_serializerRRRtgetRt_write_lock_countR1t_transactiont_reconcile_does_inventory_gct_reconcile_fixes_text_parentst_reconcile_backsup_inventory(	R-R\ta_bzrdirt
control_filest_commit_builder_classRdR9RR((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR2$sd
										cC@s[|jj}tjj|j|d|jd|j}|j}|j	|||dt
S(sAdd inv to the repository after checking the inputs.

        This function can be overridden to allow different inventory styles.

        :seealso: add_inventory, for the contract.
        RRt
check_content(R\RdRRxRR'RRRt_inventory_add_linesRJ(R-RRvRt
serializertresultt	inv_lines((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_add_inventory_checkedbs	cC@sO|jj}tj|j}||_|j}i}i}x|D]\}}	}
}|dk	r}td||
ffn|	dkrtd|
fn|	dkr|
|_	t
ddj}n*|jj
d}
t
|j|
j}||}t
|
j}|||<|
||<qCW|j|j||d|j|S(sThis will mutate new_inv directly.

        This is a simplified form of create_by_apply_delta which knows that all
        the old values must be None, so everything is a create.
        sAInvalid delta, somebody tried to delete %r from the NULL_REVISIONs:Invalid delta, delta from NULL_REVISION has no new_path %rRsutf-8RN(R\RdRRxRRt_entry_to_bytesR1Rtroot_idRtinternRQtencodet	parent_idt_populate_from_dictsR'R(R-RRRptnew_invtentry_to_bytestid_to_entry_dicttparent_id_basename_dicttold_pathtnew_pathRtentrytparent_id_basename_keytutf8_entry_namet	new_valueRz((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_create_inv_from_nullrs4				
cC@s8|js"td|fntj|d}|dkr|tjkr|j||}|jdkrtj	n|j
}	|j|||	dt|fS|j
|}|j|j}nzG|j||d|}
|
j
}	|j|||	dt|
fSWd|dk	r3|jnXdS(sAdd a new inventory expressed as a delta against another revision.

        :param basis_revision_id: The inventory id the delta was created
            against.
        :param delta: The inventory delta (see Inventory.apply_delta for
            details).
        :param new_revision_id: The revision id that the inventory is being
            added for.
        :param parents: The revision ids of the parents that revision_id is
            known to have and are in the repository already. These are supplied
            for repositories that depend on the inventory graph for revision
            graph access, as well as for those that pun ancestry with delta
            compression.
        :param basis_inv: The basis inventory if it is already known,
            otherwise None.
        :param propagate_caches: If True, the caches for this inventory are
          copied to and updated for the result if possible.

        :returns: (validator, new_inv)
            The validator(which is a sha1 digest, though what is sha'd is
            repository format specific) of the serialized inventory, and the
            resulting inventory.
        s%r not in write groupRntpropagate_cachesN(tis_in_write_groupR`Rtcheck_not_reserved_idR1RRRuRtRootMissingRRoRJt
revision_treet	lock_readtroot_inventorytcreate_by_apply_deltatunlock(R-tbasis_revision_idRtnew_revision_idRt	basis_invRt
basis_treeRzRrRq((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pytadd_inventory_by_deltas.

	cC@stjj|j||fS(N(RRxRyR'(R-RR(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_deserialise_inventorysc
c@s|dkrd}ng|D]}|f^q}|jj||t}i}xC|D];}|jdkr|jd||j<qVd||j<qVWxZ|D]R}||}	|	dkrd|dfVqtjj	|j
|	||dfVqWdS(s$Iterate over many inventory objects.RRRuiN(R1RRiRjRRwRzRRxRyR'(
R-R]torderingRRoRRRnRzR(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_iter_inventoriess	


	cC@s|jj|j|S(s%Get serialized inventory as a string.(Rdtwrite_inventory_to_stringt
get_inventory(R-R((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_get_inventory_xmls	cC@s,|jj|}td|D}|S(Ncs@s|]}|VqdS(N((RR((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pys	<genexpr>s(RRRZ(R-Ret
parent_maptpresent_inventory_keys((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_find_present_inventory_keysscC@s|j}tjj}i}tjj}zTg|D]}|f^q7}|j|}	|j|	}
t	g|
D]}|d^qt}t	|}
|
j
|t||
|}|j}|j
}|j}xtj|||d|D]\}}x~|D]v\}}||\}}}|r<|dkr<qny||j|Wqtk
rwt	|g||<qXqWqWWd|jX|S(sFind the file ids and versions affected by revisions.

        :param revisions: an iterable containing revision ids.
        :param _inv_weave: The inventory weave from this repository or None.
            If None, the inventory weave will be opened automatically.
        :return: a dictionary mapping altered file-ids to an iterable of
            revision_ids. Each altered file-ids has the exact revision_ids that
            altered it listed explicitly.
        iRqRN(tsupports_rich_rootRRxt_bytes_to_utf8name_keyRRRt_find_parent_keys_of_revisionsRRZRLR+R/R0R'RR.R|RR(R-R]t
_inv_weavet	rich_roott
bytes_to_infotfile_id_revisionsRqtrRetparent_keystpresent_parent_inv_keysRtpresent_parent_inv_idstinventories_to_readRDR/R0R'RntitemsRQR(t	name_utf8RR((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pytfileids_altered_by_revision_idss>
	 
				
#cC@s|jj}i}|j}tjj}z|j}t|}xt|j	|D]\}}|j
d||xz|jD]l\}	}
|r|
j|j
krqn|
j|
jf}|j|t|
j|jkrt||<qqWqaW|SWd|jXdS(s`Find the text key references within the repository.

        :return: A dictionary mapping text keys ((fileid, revision_id) tuples)
            to whether they were referred to by the inventory of the
            revision_id that they contain. The inventory texts from all present
            revision ids are assessed to generate this report.
        sFinding text referencesN(RRoRRRRtall_revision_idsR%Rktiter_inventoriesRLtiter_entriesRRuR
RRJRRjR(R-ReRqt
rich_rootsRqtall_revsttotaltposRvRRRz((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pytfind_text_key_references%s$"cC@s6ddlm}||dtdt}|j|S(sWReconcile this repository to make sure all CHKs are in canonical
        form.
        i(tPackReconcilertthoroughtcanonicalize_chks(tbzrlib.reconcileRRjt	reconcile(R-Rt
reconciler((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pytreconcile_canonicalize_chksEs
cC@st|||}|j|S(N(RR	(R-t
collectionRft	extensiontrevsRqtpacker((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_reconcile_packOscC@s"t||||}|j|S(N(RR	(R-RRfRRRqR((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_canonicalize_chks_packSscC@s8|jj|jkr"t||Stt|j|S(s3Return a source for streaming from this repository.(R\RdtGroupCHKStreamSourceR_RTt_get_source(R-t	to_format((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRWs
cc@s|jstn|j}|dkr?|jd}nx|D]y\}}|dkran|j|fg}td||fD}t|j}||krF|||fVqFqFWdS(smFind revisions with different parent lists in the revision object
        and in the index graph.

        :param revisions_iterator: None, or an iterator of (revid,
            Revision-or-None). This iterator controls the revisions checked.
        :returns: an iterator yielding tuples of (revison-id, parents-in-index,
            parents-in-revision).
        cs@s|]}|dVqdS(iN((Rtparent((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pys	<genexpr>ssN(RR`RR1t_iter_revisionsRRt
parent_ids(R-trevisions_iteratorRtrevidR
Rtparents_according_to_indextparents_according_to_revision((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt#_find_inconsistent_revision_parentsas			cC@s.t|j}|r*tjdndS(Ns(Revision index has inconsistent parents.(R
RRt
BzrCheckError(R-tinconsistencies((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt(_check_for_inconsistent_revision_parentszsN(RWRXRR2RsRR1RJRRRRRRRRRRRRRR(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRT!s"	>		'2			
	3	 
			
RcB@sGeZdZdZedZdZdZdZdZ	RS(s=Used when both the source and target repo are GroupCHK repos.cC@sJtt|j||d|_d|_d|_d|_d|_dS(s5Create a StreamSource streaming from from_repository.RhN(	R_RR2R1t_revision_keyst
_text_keyst_text_fetch_orderRbRc(R-tfrom_repositoryR((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR2s				c@s4g_g_fd}d|fS(sGet a stream of inventory texts.

        When this function returns, self._chk_id_roots and self._chk_p_id_roots
        should be populated.
        c	3@sUt}t}jj}|jdt}x|D]}|jdkrsr[q:qstj|jn|j	d}t
jjd||j}|jj}||krjj||j|n|j}|dkrtdn|j}||kr4|j|jj|n|Vq:W|j|jdS(NRhRRus Parent id -> file_id map not set(RZRRRiRjRRR2RzRwRRxRyR1R{RbR$R|R}R`RcR~(	RRRrRRnR(RRzR(tallow_absentRR-(sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRs6			
	
	
R(RbRc(R-RRR((RRR-sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_get_inventory_streams		c#@st_|jtj|s7ttnjj|}g|D]}|d^qP}ttxFjj|D]2}j|j	j
j|jj
qWjjfd}d|fVfd}d|fVdS(Nic3@s\tjj}x4t|jtjD]}|dk	r1|Vq1q1Wd_dS(N(RR.RbR1RRR1(tinteresting_nodesRn(R'R-R0(sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_filter_id_to_entrys	R'c3@sJx:tjjD] \}}|dk	r|VqqWd_dS(N(RR.RcR1(RnR(R'R-R4(sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt(_get_parent_id_basename_to_file_id_pagess
(
RZRtdiscardRRRRRR|R{RzR}R'(R-texcluded_revision_keystpresent_keysRtpresent_idsRvRR((R'R-R4R0sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_get_filtered_chk_streamss&						cC@s+|jjj|j|jt}d|fS(NR(RRRiRRRJ(R-ttext_stream((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_get_text_streamscc@sd}|j}tjj}|j}|jjt|x6|j|D]%}|d||||dfVqSWg|D]}|f^q|_|j	}|j
|j}	|j	jj|j	j
j|j	jj|j	jj|j|j}
|
d||||
dfV|j	jjx6|j|	D]%}|d||||dfVqGW|j	jj|j}
|
d||||
dfV|j	jj|jd|j|j|jdS(Ncs@shd}x[|D]S}||jkrQ|j||jd|j|jd}n|d7}|Vq
WdS(s1Yield records from stream while showing progress.itEstimateiN(tSTEPt	incrementRLtcurrenttmax(RqtrcRtcountRn((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pytwrap_and_counts

	
iitDone(tget_keysRRRt_record_countertsetupR%t_fetch_revision_textsRRRRtclear_cacheRt_unstacked_providert
disable_cachetenable_cacheRRRR'RRRLRR(R-tsearchRR]RqRtstream_infotrev_idt	from_repoRts((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt
get_streams6			#cc@st}xI|D]A}|ddkr@td|dfn|j|dqW|jsg|jrvtdn|j|dtVx|jtD]}|VqWdS(NiRsHThe only missing keys we should be filling in are inventory keys, not %sisTCannot call get_stream_for_missing_keys until all of get_stream() has been consumed.R(RZR`R|RbRcRRjR(R-tmissing_keystmissing_inventory_keysRzR((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pytget_stream_for_missing_keyss	
(
RWRXRR2RJRRRRR(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRs		)	(		+t_InterestingKeyInfocB@s,eZdZdZdZdZRS(cC@s4t|_t|_t|_t|_dS(N(RZR/R3R0R4(R-((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR2+scC@s|jj|jS(N(R/tunionR3(R-((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pytall_interesting1scC@s|jj|jS(N(R0RR4(R-((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pytall_uninteresting4s	cC@s|jj|jS(N(RRR(R-((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR,8s(RWRXR2RRR,(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR*s			cC@st}x|j|dD]v}|jj}|jj}|j|krr|jj||jj|q|j	j||j
j|qW|S(NR(RRR{RzR}RR0R|R4R/R3(Rt
inventory_idstparent_only_inv_idsRqRvtroot_keytpid_root_key((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR+<s	cc@sR|j}xB|D]:\}}|g|D]\}}||^q&|VqWdS(sdIterate the result of iter_interesting_nodes, yielding the records
    and adding to text_keys.
    N(RL(tinteresting_nodes_iterableRtbytes_to_text_keyttext_keys_updateRnRtntb((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR1Js	)tRepositoryFormat2acB@seZdZeZeZeZeZ	eZ
ejZ
eZeZeZdZeZeZeZdZdZeeeZedZdZRS(s;A CHK repository that uses the bencode revision serializer.RcC@stjjdS(Nt2a(Rtformat_registrytmake_bzrdir(R-((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_get_matching_bzrdirlscC@sdS(N((R-tformat((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt_ignore_setting_bzrdiroscC@sdS(Ns6Bazaar repository format 2a (needs bzr 1.16 or later)
((tcls((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pytget_format_stringtscC@sdS(s.See RepositoryFormat.get_format_description().sHRepository format 2a - rich roots, group compression and chk inventories((R-((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pytget_format_descriptionxs(RWRXRRTtrepository_classRjtsupports_external_lookupsR]RRmtrich_root_dataRtchk_bencode_serializerRdt_commit_inv_deltasRRURR5t_fetch_orderRJt_fetch_uses_deltastfast_deltastpack_compressesR	Rtpropertyt_matchingbzrdirtclassmethodR
R(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRTs&			tRepositoryFormat2aSubtreecB@sSeZdZdZdZeeeZedZdZ	e
Ze
ZRS(s8A 2a repository format that supports nested trees.

    cC@stjjdS(Nsdevelopment-subtree(RRR(R-((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR	scC@sdS(N((R-R
((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRscC@sdS(NsBazaar development format 8
((R((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR
scC@sdS(s.See RepositoryFormat.get_format_description().sUDevelopment repository format 8 - nested trees, group compression and chk inventories((R-((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyRs(
RWRXRR	RRRRR
RRjtexperimentaltsupports_tree_reference(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyR~s			(8Rt
__future__RRBtbzrlibRRRRRRRRRR	R
RRRR
tbzrlib.btree_indexRRtbzrlib.decoratorsRtbzrlib.groupcompressRRtbzrlib.repofmt.pack_repoRRRRRRRRRtbzrlib.vf_repositoryRtbzrlib.static_tupleRRRYR\RRR$RTRtobjectRR+R1RR(((sE/usr/lib/python2.7/dist-packages/bzrlib/repofmt/groupcompress_repo.pyt<module>s0X@sDUiaa		
*

Copyright © 2017 || Recoded By Mr.Bumblebee