-=[ Mr. Bumblebee ]=-
_Indonesia_

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


Ӈ>Oc@@sidZddlmZddlZddlmZddlZddlZddlm	Z	m
Z
ddlmZddl
mZmZddlmZmZmZmZdd	lmZmZdd
lmZmZddlmZddlmZmZdd
l m!Z!ddl"m#Z#de$fdYZ%de$fdYZ&de!fdYZ'dZ(dS(sCRead in a bundle stream, and process it into a BundleReader object.i(tabsolute_importN(tStringIO(tosutilst	timestamp(tapply_bundle(tTestamentMismatchtBzrError(t	InventorytInventoryDirectoryt
InventoryFilet
InventoryLink(t
sha_stringtpathjoin(tRevisiont
NULL_REVISION(tStrictTestament(tmuttertwarning(tTree(t
serializer_v5tRevisionInfocB@s8eZdZdZdZdZedZRS(s;Gets filled out for each revision object that is read.
    cC@sp||_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_dS(N(
trevision_idtNonetsha1t	committertdateRttimezonetinventory_sha1t
parent_idstbase_idtmessaget
propertiesttree_actions(tselfR((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyt__init__4s											cC@stj|jS(N(tpprinttpformatt__dict__(R!((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyt__str__CscC@std|jd|jdt|jdt|jd|jddj|j	}|j
rs|j
j|j
n|jrx|jD]}|j
d}|d	kr|jd
st|nt|d	 }d}nt|| }||d}||j|<qWn|S(
NRRRRRRs
s: it:ti(R
RRtfloatRtintRRtjoinRRtextendRtfindtendswitht
ValueErrortstr(R!trevtpropertytkey_endtkeytvalue((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytas_revisionFs(					cC@st|j}tj|j|j}||_|j|_|j|_|jjd|_g|jj	D]}dj
|^qm|_|S(Ns
s: (RRRtformat_highres_dateRRRtsplitRt	iteritemsR+(trevisiont
revision_infoRtp((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyt
from_revision`s	+(t__name__t
__module__t__doc__R"R&R6tstaticmethodR=(((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyR1s
			t
BundleInfocB@seZdZddZdZdZdZdZe	eddZ
dZd	Zdd
Z
dZdZd
ZdZedZdZRS(smThis contains the meta information. Stuff that allows you to
    recreate the revision or inventory XML.
    cC@sUd|_d|_d|_d|_g|_g|_d|_d|_t	|_
dS(N(Rt
bundle_formatRRRt	revisionstreal_revisionsRRtFalset!_validated_revisions_against_repo(R!RC((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyR"rs								cC@stj|jS(N(R#R$R%(R!((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyR&scC@sddlm}|jrA|jrA||j\|_|_ng|_x|jD]}|jdkr|jdk	r||j\|_|_q|j|_|j|_n|jdkr|jr|j|_n|j	dkr|j	r|j	|_	n|jj
|jqTWdS(sThis makes sure that all information is properly
        split up, based on the assumptions that can be made
        when information is missing.
        i(tunpack_highres_dateN(tbzrlib.timestampRHRRRRERDRRRtappendR6(R!RHR1((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyt
complete_infos	cC@sP|j|j}|jdk	r(|jSt|jdkrAtS|jdSdS(Nii(tget_revision_infoRRRtlenRR(R!R:R;((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytget_basescC@sJt|jdkr#|jdjSt|jdkrF|jdjSdS(sReturn the target revision.iN(RMRERRDR(R!((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyt_get_targets
tdocsThe target revision idcC@s7x$|jD]}|j|kr
|Sq
Wt|dS(N(RERtKeyError(R!Rtr((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytget_revisionscC@s7x$|jD]}|j|kr
|Sq
Wt|dS(N(RDRRQ(R!RRR((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRLsc	C@s|j|}|j|}||kr6tn|jsO|j|n|j|}|}t|j||}|j|||j	}|j
|||j|||S(N(RSRNtAssertionErrorRGt$_validate_references_from_repositoryRLt
BundleTreet
revision_treet_update_treet	inventoryt_validate_inventoryt_validate_revision(	R!t
repositoryRtbaseR:R;tinventory_revision_idtbundle_treetinv((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRWs			cC@s|i}i}d}i}x4|jD])}t||j<|||j|jq%Wx9t|j|jD]"\}}|||j|jqhWd}i}	x|jD]\}
}|j|
rt	j
||
}|j||
}
||
krtd|
|
|fq4|d7}q|
|kr||	|
<qqWt
|	dkratdt
|	ntd|t|_dS(sNow that we have a repository which should have some of the
        revisions we care about, go through and validate all of them
        that we can.
        cS@sx|dkr+|dk	r'tdndS||krj|||krttd||||fqtn
|||<dS(Ns2A Null revision should alwayshave a null sha1 hashs>** Revision %r referenced with 2 different sha hashes %s != %s(RR(tdRR((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytadd_shasis8sha1 mismatch. For revision id {%s}local: %s, bundle: %sisENot all revision hashes could be validated. Unable validate %d hashess&Verified %d sha hashes for the bundle.N(RDtTrueRRtzipRERR9thas_revisionRR=t_testament_sha1_from_revisionRRMRRRG(R!R\t
rev_to_shat
inv_to_shaRbtcheckedtrev_infoR1tcounttmissingRRt	testamentt
local_sha1((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRUs8	
"				
cC@stj|}t|}|j|}|j|krEtn||jkrtdd}z|j|Wd|j	Xt
d|||jfndS(sAt this point we should have generated the BundleTree,
        so build up an inventory, and make sure the hashes match.
        s,,bogus-invtwbNs5Inventory sha hash mismatch for revision %s. %s != %s(Rtwrite_inventory_to_stringRRSRRTRtopentwritetcloseR(R!R`RtsRR1tf((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRZscC@si}|j|}|j|}|j|jksBtn|j|ks]tn|j||}||jkrt|j|j|n|j|krtd|jn|||j<dS(s4Make sure all revision entries match their checksum.s%Revision {%s} given twice in the listN(RSRLRRTt_testament_sha1RRR(R!ttreeRtrev_to_sha1R1RjR((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyR[%sc@sfdfdfdfd}fd}fd}fd}i|d6|d	6|d
6|d6}x|jjD]\}}	|jd}
|
d
krtd|n|jd|
d}|d
kr(td|n||
 }||
d|!}
|
dkrhtd|
|fn||d}||krtd|n|||
||	qWdS(sThis fills out a BundleTree based on the information
        that was read in.

        :param bundle_tree: A BundleTree to update with the new information.
        c@s>|dk	r$tj|dt}n}j|||S(Ntwarn(RRtsafe_revision_idRFtnote_last_changed(tlast_changedtpathtkindtchanged_revision_id(R_R(s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyt
get_rev_id@sc@sd}d}x|D]}y|jdd\}}Wn!tk
rXtd|nX|dkrn|}q|dkr|dk}j||q|dkrj||q|dkr|}qqW||fS(	NR'isValue %r has no colonslast-changedt
executabletyesttargettencoding(RR8R/tnote_executabletnote_target(tinfotnew_pathR|Rt	info_itemtnameR5tval(R_(s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyt
extra_infoKs"

	
c@se|dkr'tjdj|}n*|dkrEdj|}nt|j||dS(Ntbase64R((RtdecodestringR+RR/t
note_patch(R}tlinesRtpatch(R_(s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytdo_patch^sc	@s|jd}t|dkr4td|n|d}|djdrb|dd}n
|d}j|||d|\}}|||}|r|||ndS(Ns // is0renamed action lines need both a from and to: %riis=> i(R8RMRt
startswithtnote_rename(	R~textraRRtold_pathRt
last_modifiedRR:(R_RRR(s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytrenamedgs


c@sO|jd}t|dkr4td|n|d}j|dS(Ns // is2removed action lines should only have the path: %ri(R8RMRt
note_deletion(R~RRRR}(R_(s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytremovedxs

c	@s|jd}t|dkr4td|n%t|dkrYtd|n|d}|djdstd|ntj|dd	d
t}j|||j|t|d|\}}|||}|dkrdS|||dS(
Ns // is1add action lines require the path and file id: %ris/add action lines have fewer than 5 entries.: %risfile-id:s1The file-id should follow the path for an add: %riRyit	directory(	R8RMRRRtsafe_file_idRFtnote_idR(	R~RRRR}tfile_idR|RR:(R_RRR(s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytaddeds&



c@s|jd}t|dkr4td|n|d}|d|\}}|||}|r|||ndS(Ns // is7modified action lines have at leastthe path in them: %ri(R8RMR(R~RRRR}RRR:(RRR(s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytmodifieds

RRRRt is(Bogus action line (no opening space): %ris,Bogus action line (missing second space): %rtfileRtsymlinks.Bogus action line (invalid object kind %r): %rs+Bogus action line (unrecognized action): %rN(sfiles	directoryssymlink(RLR R-R(R!R_RRRRRt
valid_actionstaction_lineRtfirsttsecondtactionR~R((R_RRRRs=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRX9s@	





cC@stj|||jS(sInstall revisions and return the target revision

        :param target_repo: The repository to install into
        :param stream_input: Ignored by this implementation.
        (Rtinstall_bundleR(R!ttarget_repotstream_input((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytinstall_revisionsscC@sd|jdfS(s}Provide data for performing a merge

        Returns suggested base, suggested target, and patch verification status
        tinapplicableN(RR(R!R((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytget_merge_requestsN(R>R?R@RR"R&RKRNROR2RRSRLRWRURZR[RXRcRR(((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRBns 			
				8				RVcB@seZdZdZdZddZdZdZdZdZ	d	Z
d
ZdZdZ
d
ZdZdZdZddZdZdZdZdZdZdZeeZeeZdZededZ dZ!RS(cC@s||_i|_i|_i|_i|_i|_i|_i|_i|_i|_	g|_
t|_||_
d|_dS(N(t	base_treet_renamedt
_renamed_rt_new_idt	_new_id_rt_kindst
_last_changedt_executabletpatchest_targetstdeletedRctcontents_by_idRRt
_inventory(R!RR((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyR"s													cC@stj|jS(N(R#R$R%(R!((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyR&scC@sZ||jkrt|n||jkr<t|n||j|<||j|<dS(s;A file/directory has been renamed from old_path => new_pathN(RRTR(R!RR((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRs
RcC@s+||j|<||j|<||j|<dS(s-Files that don't exist in base need a new id.N(RRR(R!tnew_idRR~((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRs

cC@sV||jkrE|j||krEtd||j||fn||j|<dS(Ns;Mismatched last-changed revision for file_id {%s}: %s != %s(RR(R!RR((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyR{s
cC@s||j|<dS(s&There is a patch for a given filename.N(R(R!RR((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRscC@s||j|<dS(s0The symlink at the new path has the given targetN(R(R!RR((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRscC@s|jj|dS(s&The file at old_path has been deleted.N(RRJ(R!R((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyR	scC@s||j|<dS(N(R(R!RR((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyR
scC@s|d dkrt|n|jj|}|dk	rA|Stjj|\}}|dkr|j|}|dkrd}qt||}n|}||j	krdS|S(sAGet the old_path (path in the base_tree) for the file at new_pathis\t/R((s\RN(
R/RtgetRtosR}R8RRR(R!RRtdirnametbasenametold_dir((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRs	cC@s|d dkrt|n|jj|}|dk	rA|S||jkrTdStjj|\}}|dkr|j|}|dkrd}qt	||}n|}||jkrdS|S(sfGet the new_path (path in the target_tree) for the file at old_path
        in the base tree.
        is\RR((s\RN(
R/RRRRRR}R8RR(R!RRRRtnew_dir((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyR)s"	cC@s
|jdS(NR((tpath2id(R!((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytget_root_idCscC@sd|jj|}|dk	r"|S|j|}|dkrAdS||jkrTdS|jj|S(s=Return the id of the file present at path in the target tree.N(RRRRRRR(R!R}RR((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRFscC@sd|jj|}|dk	r"|S|jj|}|dkrDdS||jkrWdS|j|S(sBReturn the new path in the target tree of the file with id file_idN(RRRRtid2pathRR(R!RR}R((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRRscC@sE|jr&|jj|r|SdSn|j|}|jj|S(suReturn the id in the base_tree for the given file_id.
        Return None if the file did not exist in base.
        N(RRthas_idRRR(R!RR((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytold_contents_id^s	cC@s|j|}|dk	rE||jjkrE|jj|}nd}|jj|j|}|dkr|dkr|j|dkrt	S|dkrt
d|n|S|jdrtd||fnt
||S(s
Return a file-like object containing the new contents of the
        file given by file_id.

        TODO:   It might be nice if this actually generated an entry
                in the text-store, so that the file contents would
                then be cached.
        RsNone: %ss\sMalformed patch for %s, %rN(RRRRtget_fileRRRR~RRTRR/tpatched_file(R!RRtpatch_originalt
file_patch((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRjs"cC@sR|dkr|j|}ny|j|SWntk
rM|jj|SXdS(N(RRRRQRtget_symlink_target(R!RR}((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRs
cC@s*||jkr|j|S|jj|S(N(RRR~(R!R((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyR~scC@s=|j|}||jkr)|j|S|jj|SdS(N(RRRtget_file_revision(R!RR}((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRscC@s=|j|}||jkr)|j|S|jj|SdS(N(RRRt
is_executable(R!RR}((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRscC@s9|j|}||jkr)|j|S|jj|S(N(RRRR(R!RR}((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytget_last_changedscC@s|j|}|dkrdS||jkr\|jj|}|jj|}||fS|j|}|j}t|t	|fS(sReturn the size and sha1 hash of the given file id.
        If the file was not locally modified, this is extracted
        from the base_tree. Rather than re-reading the file.
        N(NN(
RRRRt
get_file_sizet
get_file_sha1RtreadRMR(R!RRt	text_sizet	text_sha1tfileobjtcontent((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytget_size_and_sha1s
c@sqddlmmtdjfd}j}x|D]\}}||qSWS(s~Build up the inventory entry for the BundleTree.

        This need to be called before ever accessing self.inventory
        i(RRc@sij|}|dkrdS|dkr4d}n|}j|}j|}j|}|}|dkrt|||}ni|dkrt|||}j||_n6|dkrt	|||}j
|||_n||_|dkrXj
|\|_|_|jdkrXtd|qXnj|dS(NR(RRRs&Got a text_size of None for file_id %r(RRRR~RRR	RRR
Rtsymlink_targetR:RRRRtadd(RR}t	parent_idtparent_pathR~RRtie(RRR`R!(s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyt	add_entrys2		N(tos.pathRRRRRtsorted_path_id(R!Rtsorted_entriesR}R((RRR`R!s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyt_get_inventoryscC@s/tg|jjD]\}}|j^qS(N(tsetRYtiter_entriesR(R!R}tentry((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pytall_file_idssc	c@s|j}|dkrd}n|j|}|dkr=dS|jd|d|}|jdk	r|r|dkr|jnx.|D]&\}}|d|j|j|fVqWdS(Ntfrom_dirt	recursivetV(RYRRRtroottnextR~R(	R!tinclude_rootRRR`tfrom_dir_idtentriesR}R((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyt
list_filess		"
cC@sg}x$|jjD]}|j|qWxK|jjD]:}|j|}|dkrdq=n|j||fq=W|j|S(N(RR9RJRRRRtsort(R!tpathstresulttidR}((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRs
N("R>R?R"R&RRR{RRRRRRRRRRRRRR~RRRRRR2RYtroot_inventoryRRFRcRR(((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRVs8																							2	cC@sUddlm}ddlm}|dkr6|dS|||t|jS(s=Produce a file-like object with the patched version of a texti(titer_patched(tIterableFileR(((tbzrlib.patchesRtbzrlib.iterablefileRRt	readlines(RtoriginalRR((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyRs
	()R@t
__future__RRt	cStringIORRR#tbzrlibRRt
bzrlib.bundleRt
bzrlib.errorsRRtbzrlib.inventoryRRR	R
tbzrlib.osutilsRRtbzrlib.revisionR
Rtbzrlib.testamentRtbzrlib.traceRRtbzrlib.treeRtbzrlib.xml5RtobjectRRBRVR(((s=/usr/lib/python2.7/dist-packages/bzrlib/bundle/bundle_data.pyt<module>s*"=g>

Copyright © 2017 || Recoded By Mr.Bumblebee