-=[ Mr. Bumblebee ]=-
_Indonesia_

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


:Nc@@sFdZddlmZddlZddlZddlmZeedddlm	Z	ddl
mZddlm
Z
mZmZmZmZmZd	d
ZdZdZd
dZdefdYZdefdYZdefdYZdZdefdYZdefdYZdefdYZedZ dZ!defdYZ"d efd!YZ#d"efd#YZ$d$efd%YZ%dd&l&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,y2dd'l-m'Z'm(Z(m.Z.m)Z)m*Z*eZ/Wn&e0k
rAZ1e2j3e1eZ/nXdS((s@Core compression logic for compressing streams of related files.i(tabsolute_importN(tlazy_imports
from bzrlib import (
    annotate,
    config,
    debug,
    errors,
    graph as _mod_graph,
    osutils,
    pack,
    static_tuple,
    trace,
    tsort,
    )

from bzrlib.repofmt import pack_repo
from bzrlib.i18n import gettext
(tBTreeBuilder(tLRUSizeCache(t_KeyRefstadapter_registrytAbsentContentFactorytChunkedContentFactorytFulltextContentFactorytVersionedFilesWithFallbacksiit(da39a3ee5e6b4b0d3255bfef95601890afd80709cC@si}x|jD]w\}}t|ts@t|dkrId}n
|d}y||||<Wqtk
ri||6||<qXqWg}x4t|D]&}|jttj	||qW|S(sSort and group the keys in parent_map into groupcompress order.

    groupcompress is defined (currently) as reverse-topological order, grouped
    by the key prefix.

    :return: A sorted-list of keys
    iti(
t	iteritemst
isinstancetstrtlentKeyErrortsortedtextendtreversedttsortt	topo_sort(t
parent_maptper_prefix_maptkeytvaluetprefixtpresent_keys((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytsort_gc_optimal=s
!	

$i itGroupCompressBlockcB@seZdZdZdZeefZdZdZddZ	dZ
edZe
dZdd	Zd
ZdZdZd
ZdZdZedZRS(sAn object which maintains the internal structure of the compressed data.

    This tracks the meta info (start of text, length, type, etc.)
    sgcb1z
sgcb1l
cC@sCd|_d|_d|_d|_d|_d|_d|_dS(N(tNonet_compressor_namet_z_content_chunkst_z_content_decompressort_z_content_lengtht_content_lengtht_contentt_content_chunks(tself((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt__init__is						cC@s|j|jS(N(R#R"(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt__len__sscC@s|jdkrtdn|dkr6|j}n:|jdk	rp||jkrptd||jfn|jdkr|jdk	rdj|j|_d|_qn|jdkr|jdkrtdndj|j}|dkr	d|_q|jdkr9ddl}|j	||_q|jdkr|d	|jd
kr}|j}t
j	||_qt
j|_|jj	||t
|_|jjsd|_qqtd|jnt|j|krdS|jdkrtd|n|jj}|s5td
n|t|j}|j|jj	||t
7_t|j|krtd|t|jfn|jjsd|_ndS(sMake sure that content has been expanded enough.

        :param num_bytes: Ensure that we have extracted at least num_bytes of
            content. If None, consume everything
        s)self._content_length should never be Nones.requested num_bytes (%d) > content length (%d)RsNo content to decompresstlzmaiNtzlibiisUnknown compressor: %rs&No decompressor to decompress %d bytessNothing left to decompresss"%d bytes wanted, only %d available(R#RtAssertionErrorR$R%tjoinR Rtpylzmat
decompressR*t
decompressobjR!t_ZLIB_DECOMP_WINDOWtunconsumed_tailR(R&t	num_bytest	z_contentR-tremaining_decomptneeded_bytes((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_ensure_contentysb		cC@s|jd||d}t|||!|_|d}|jd||d}t|||!|_|d}t|||jkrtdt|||jfn||f|_dS(sRead the various lengths from the header.

        This also populates the various 'compressed' buffers.

        :return: The position in bytes just after the last newline
        s
iisInvalid bytes: (%d) != %d + %dN(tindextintR"R#RR+R (R&tbytestpostpos2((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_parse_bytess


cC@s#|jdk	rdj|jSdS(sfReturn z_content_chunks as a simple string.

        Meant only to be used by the test suite.
        RN(R RR,(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt
_z_contentscC@s|}|d |jkr5td|jfn|ddkrQd|_n/|ddkrmd|_ntd|f|j|d|S(	Nis"bytes did not start with any of %ritzR*tlR)sunknown compressor: %r(tGCB_KNOWN_HEADERSt
ValueErrorRR<(tclsR9tout((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt
from_bytess	cC@s||kodknr dS|j||j|}|dkrOd}n(|dkrqtd|fnd}t|j|d|d	!\}}|d|}	||	|krtd
||	|fn|dkr|j|	|!}
n$|dkrt|j|	|}
n|
S(sExtract the text for a specific key.

        :param key: The label used for this content
        :param sha1: TODO (should we validate only when sha1 is supplied?)
        :return: The bytes for the content
        iRtftfulltexttds Unknown content control code: %stdeltaiis-end != len according to field header %s != %s(R6R$RAtdecode_base128_inttapply_delta_to_source(R&Rtstarttendtsha1tcttypetcontent_lentlen_lent
content_startR9((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytextracts*

	!cC@s(||_||_d|_d|_dS(s2Set the content of this block to the given chunks.N(R#R%RR$R (R&tcontent_chunkstlength((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytset_chunked_contents			cC@s%t||_||_d|_dS(sSet the content of this block.N(RR#R$RR (R&tcontent((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytset_content%s	cC@sxtjtj}t|j|}|j|jg|D]}|r>|^q>|_ttt	|j|_
dS(N(R*tcompressobjtZ_DEFAULT_COMPRESSIONtmaptcompresstappendtflushR tsumRR"(R&tchunkst
compressortcompressed_chunksRN((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_create_z_content_from_chunks+s
"cC@sK|jdk	rdS|jdk	r.|j}n|jf}|j|dS(N(R RR%R$Rc(R&R`((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_create_z_content5scC@s^|j|j}d||j|jfg}|j|jttt|}||fS(s.Create the byte stream as a series of 'chunks's%s%d
%d
(	Rdt
GCB_HEADERR"R#RR R_R[R(R&theaderR`t	total_len((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt	to_chunks>s
	cC@s|j\}}dj|S(s*Encode the information into a byte stream.R(RhR,(R&RgR`((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytto_bytesIscC@s|jg}d}x||jkr|j|}|d7}|dkratd|fnt|j||d!\}}||7}|||jkrtd|||dfn|dkr|r|j|||!}|jd||fq|jd|fn|dkr|j|||!}g}	t|\}
}|jd||
|	fd}x||kr_t||}
|d7}|
d@rt||
|\}}}|r|j|||!}|	jd	|||fn|	jd	||f||7}qn|r,||||
!}nd
}|	jd|
|f||
7}||
7}qnW||krtd||fn||
krtd
|
|fqn||7}qW|S(sTake this block, and spit out a human-readable structure.

        :param include_text: Inserts also include text bits, chose whether you
            want this displayed in the dump or not.
        :return: A dump of the given block. The layout is something like:
            [('f', length), ('d', delta_length, text_length, [delta_info])]
            delta_info := [('i', num_bytes, text), ('c', offset, num_bytes),
            ...]
        iiRERGsinvalid kind character: %ris*invalid content_len %d for record @ pos %diRNRtis.Delta consumed a bad number of bytes: %d != %dsHDelta claimed fulltext was %d bytes, but extraction resulted in %d bytes(RERG(R6R#R$RARIR]tordtdecode_copy_instruction(R&tinclude_texttresultR:tkindRPRQttextt
delta_contentt
delta_infot
decomp_lent	delta_postmeasured_lenRNtoffsetRUttxt((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_dumpNsd






	

N(t__name__t
__module__t__doc__Ret
GCB_LZ_HEADERR@R'R(RR6R<tpropertyR=tclassmethodRDRSRVRXRcRdRhRitFalseRx(((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR]s$	
	N	
"			
				t_LazyGroupCompressFactorycB@s)eZdZdZdZdZRS(s2Yield content from a GroupCompressBlock on demand.cC@sg||_||_d|_||_d|_d|_|sHd|_n||_||_||_	dS(sCreate a _LazyGroupCompressFactory

        :param key: The key of just this record
        :param parents: The parents of this key (possibly None)
        :param gc_block: A GroupCompressBlock object
        :param start: Offset of the first byte for this record in the
            uncompressd content
        :param end: Offset of the byte just after the end of this record
            (ie, bytes = content[start:end])
        :param first: Is this the first Factory for the given block?
        sgroupcompress-blocksgroupcompress-block-refN(
RtparentsRRMt_managert_byteststorage_kindt_firstt_startt_end(R&RRtmanagerRKRLtfirst((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR's								cC@sd|jj|j|jfS(Ns%s(%s, first=%s)(t	__class__RyRR(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt__repr__scC@s||jkr,|jr%|jjSdSn|dkr|jdkry|jjWn/tjk
r}t	j
dt|nX|jj}|j
|j|j|j|_n|dkr|jS|jgSnt	j|j||jdS(NRRFtchunkedszlib: (sfulltextR(RRRt_wire_bytesRRt_prepare_for_extractR*terrorterrorstDecompressCorruptionRt_blockRSRRRtUnavailableRepresentation(R&RRtblock((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytget_bytes_ass"	
$
(RyRzR{R'RR(((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRs		t_LazyGroupContentManagercB@seZdZdZdZdZdZdZddZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZedZRS(s:This manages a group of _LazyGroupCompressFactory objects.g?iiiiicC@s1||_g|_d|_||_d|_dS(Ni(Rt
_factoriest
_last_bytet
_get_settingsRt_compressor_settings(R&Rtget_compressor_settings((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR's
				cC@sh|jdk	r|jSd}|jdk	r:|j}n|dkrXt}|j}n||_|jS(N(RRRtGroupCompressVersionedFilest_DEFAULT_COMPRESSOR_SETTINGS(R&tsettingstvf((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_get_compressor_settingss	cC@se|jst}nt}t|||||d|}||jkrQ||_n|jj|dS(NR(RtTrueRRRR](R&RRRKRLRtfactory((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytadd_factorys		cc@s/x(|jD]}|Vd|_d|_q
WdS(s'Get a record for all keys added so far.N(RRRR(R&R((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytget_record_streams	cC@sVtjd|jj|t}|jj||j|jj| ||_dS(s?Create a new GroupCompressBlock, with just some of the content.s:stripping trailing bytes from groupcompress block %d => %dN(ttracetmutterRR#RR6RXR$(R&t	last_bytet	new_block((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_trim_blocks		cC@st|jS(N(tGroupCompressorR(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_make_group_compressorscC@s|j}tj}|jj}d}xb|jD]W}|jd}|j|j||j\}}}}	||_||_	||_
q4W||_|j}
tj|}|
|_t
jd|||jjdS(s?Create a new GroupCompressBlock with only the referenced texts.iRFsFcreating new compressed block on-the-fly in %.3fs %d bytes => %d bytesN(RttimeRR#RRR\RRMRRRR^RR(R&Rattstartt
old_lengtht	end_pointRR9t
found_sha1tstart_pointRORRH((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_rebuild_blocks"'		
	
		cC@s|jj|jdS(s<A _LazyGroupCompressFactory is about to extract to fulltext.N(RR6R(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR:scC@sd}d}x@|jD]5}||j|j7}||jkr|j}qqW|d|jjkrrd||fS|d|krd||fSd||fS(s-Check to see if our block should be repacked.iittrimtrebuildN(RRRRR#R(R&ttotal_bytes_usedtlast_byte_usedR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_check_rebuild_actionBs


cC@st|jdkrtS|j\}}}|jj}|||jkrQtS||jkrdtSd}xV|jD]K}|j
d }|dkr|}qt||krt||jkrtSPqtqtWtS(sIs the current block considered 'well utilized'?

        This heuristic asks if the current block considers itself to be a fully
        developed group, rather than just a loose collection of data.
        iiN(RRRRRR#t_max_cut_fractiont_full_enough_block_sizeRRRt_full_enough_mixed_block_size(R&tactionRRt
block_sizet
common_prefixRR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytcheck_is_well_utilizedas$
	cC@sq|j\}}}|dkr%dS|dkrA|j|n,|dkrZ|jntd|fdS(NRRsunknown rebuild action: %r(RRRRRA(R&RRR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_check_rebuild_blocks
cC@s7|jdg}g}x|jD]x}dj|j}|j}|d	krYd}ndjd|D}d|||j|jf}|j|q#Wdj|}~t	|}	t
j|}
~t	|
}|jj
\}}
|jd||	|f|j|
|j|
~
~
dj|S(
s=Return a byte stream suitable for transmitting over the wire.sgroupcompress-block
tsNone:s	cs@s|]}dj|VqdS(RN(R,(t.0R((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pys	<genexpr>ss%s
%s
%d
%d
Rs	%d
%d
%d
N(RRR,RRRRRR]RR*R\RRhR(R&tlinestheader_linesRt	key_bytesRtparent_bytest
record_headertheader_bytestheader_bytes_lentz_header_bytestz_header_bytes_lentblock_bytes_lentblock_chunks((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRs2
				

cC@sT|jdd\}}}}}~|dkrFtd|fnt|}t||krstdn|| }t|}tj|}t||krtdn~t|}t|||krtdn||}	~|jd}
~|
j}|dkr3td	nt|
dd
krXtdntj|	}~	||}
xt	d
t|
dD]}t
|
|jd}|
|d
}|dkrd}n=t
g|jdD]!}|rt
|jd^q}t|
|d}t|
|d}|
j||||qW|
S(Ns
isgroupcompress-blocksUnknown storage kind: %ss,Compressed header len shorter than all bytess%invalid length for decompressed bytessInvalid length for blockRs0header lines did not end with a trailing newlineis.The header was not an even multiple of 4 linesRisNone:s	ii(
tsplitRAR8RR*R.tpopRRDtxrangettupleRR(RBR9Rtz_header_lent
header_lent	block_lentresttz_headerRftblock_bytesRtlastRRnRKRtparents_lineRtsegmenttstart_offsett
end_offset((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRDsP!

	$ii@ii ii0iiN(RyRzR{Rt_full_block_sizet_full_mixed_block_sizeRRRR'RRRRRRRRRRRR~RD(((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRs&			
						>		0cC@s;|dkr"td|fntj|}|jS(Nsgroupcompress-blocksUnknown storage kind: %s(RARRDR(RR9tline_endR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytnetwork_block_to_recordsst_CommonGroupCompressorcB@sSeZddZdedZedZdZdZdZ	dZ
RS(cC@sgg|_d|_d|_d|_i|_d|_t|_|dkrZi|_	n	||_	dS(sCreate a GroupCompressor.iN(
R`Rt_lasttendpointtinput_bytest
labels_deltast_delta_indexRRt	_settings(R&R((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR's						c
C@s|s1|tkr!tjntdddfS|dk	rF|}ntj|}|dk	r||krtjqn|ddkr|d d|f}n|j||t|d|\}}}	||||	fS(sCompress lines with label key.

        :param key: A key tuple. It is stored in the output
            for identification of the text during decompression. If the last
            element is 'None' it is replaced with the sha1 of the text -
            e.g. sha1:xxxxxxx.
        :param bytes: The bytes to be compressed
        :param expected_sha: If non-None, the sha the lines are believed to
            have. During compression the sha is calculated; a mismatch will
            cause an error.
        :param nostore_sha: If the computed sha1 sum matches, we will raise
            ExistingContent rather than adding the text.
        :param soft: Do a 'soft' compression. This means that we require larger
            ranges to match to be considered for a copy command.

        :return: The sha1 of lines, the start and end offsets in the delta, and
            the type ('fulltext' or 'delta').

        :seealso VersionedFiles.add_lines:
        iRFissha1:iN(t
_null_sha1RtExistingContentRtosutilst
sha_stringt	_compressR(
R&RR9texpected_shatnostore_shatsoftRMRKRLRO((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR\&s	+cC@st|jdS(sQCompress lines with label key.

        :param key: A key tuple. It is stored in the output for identification
            of the text during decompression.

        :param bytes: The bytes to be compressed

        :param max_delta_size: The size above which we issue a fulltext instead
            of a delta.

        :param soft: Do a 'soft' compression. This means that we require larger
            ranges to match to be considered for a copy command.

        :return: The sha1 of lines, the start and end offsets in the delta, and
            the type ('fulltext' or 'delta').
        N(tNotImplementedErrorR(R&RR9tmax_delta_sizeR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRMscC@sy|j|\}}}}|j||!}dj|}|ddkrt|dd!\}}	|d|	}
|
t|krtdt||
fn||	d}ndj|j| }|ddkrtd|dfnt|dd!\}
}	|
d|	}
|
t|krItd	t||
fnt|||	d}tj|}||fS(
sExtract a key previously added to the compressor.

        :param key: The key to extract.
        :return: An iterable over bytes and the sha1.
        RiREii
s;Index claimed fulltext len, but stored bytes claim %s != %sRGs$Unknown content kind, bytes claim %ss8Index claimed delta len, but stored bytes claim %s != %s(	RR`R,RIRRAtapply_deltaRR(R&Rt
start_bytetstart_chunktend_bytet	end_chunktdelta_chunkststored_bytestfulltext_lenRvtdata_lenR9tsourcet	delta_lent
bytes_sha1((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRS`s,cC@s2|jj|j|jd|_d|_|jS(s}Finish this group, creating a formatted stream.

        After calling this, the compressor should no longer be used
        N(RRVR`RRR(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR^s		cC@s7d|_|j|jd3|jd|_d|_dS(sCall this if you want to 'revoke' the last compression.

        After this, the data structures will be rolled back, but you cannot do
        more compression.
        iiN(RRR`RR(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytpop_lasts	cC@st|jt|jS(s%Return the overall compression ratio.(tfloatRR(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytratiosN(RyRzRR'RR\RRSR^RR(((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRs'	!	
	tPythonGroupCompressorcB@s eZddZedZRS(cC@s8tt|j|tg|_|jj|_dS(s\Create a GroupCompressor.

        Used only if the pyrex version is not available.
        N(tsuperRR'tLinesDeltaIndexRRR`(R&R((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR'scC@sdt|}tj|}|jj|d|d|\}}ttt|}	|	|krd}
dt|g}|j|t	t	g}|jt
gt|n d}
d|d<t|	|d<|j}t|j}||jf|_
|jj|||jj|_|j|7_t|j}
|||j|
f|j|<||j|
fS(	s$see _CommonGroupCompressor._compresstbytes_lengthRRFRERHRGii(RRtsplit_linesRt
make_deltaR_R[tencode_base128_intRRRRR`Rtextend_linesRR(R&RR9RRt	input_lent	new_linest	out_linestindex_linestdelta_lengthRORKtchunk_startt	chunk_end((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRs0	

	N(RyRzRR'RR(((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRs
tPyrexGroupCompressorcB@s/eZdZddZedZdZRS(sProduce a serialised group of compressed texts.

    It contains code very similar to SequenceMatcher because of having a similar
    task. However some key differences apply:

    * there is no junk, we want a minimal edit not a human readable diff.
    * we don't filter very common lines (because we don't know where a good
      range will start, and after the first text we want to be emitting minmal
      edits only.
    * we chain the left side, not the right side
    * we incrementally update the adjacency matrix as new lines are provided.
    * we look for matches in all of the left side, so the routine which does
      the analagous task of find_longest_match does not need to filter on the
      left side.
    cC@sAtt|j||jjdd}td||_dS(Ntmax_bytes_to_indexi(RRR'Rtgett
DeltaIndexR(R&RR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR'scC@st|}|jj|jkr0tdn|jj||}|dkrd}tt|}dt|}	|jj||	d||g}
nJd}tt|}dt|}	d||g}
|jj	||	|j}t|j
}|j|
|j|7_t|j
}
|||j|
f|j
|<|jj|jks~td|jj|jfn||j|fS(	s$see _CommonGroupCompressor._compresssW_source_offset != endpoint somehow the DeltaIndex got out of sync with the output linesRFiRERHRGs<the delta index is out of syncwith the output lines %s != %sN(RRt_source_offsetRR+RRRt
add_sourcetadd_delta_sourceR`t_output_chunksRR(R&RR9RRRRHROt
enc_lengthtlen_mini_headert
new_chunksRKR
R((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRs4
	
cC@sZt|j|jf|_|j}|jj||ttt|7}||_dS(sNOutput some chunks.

        :param new_chunks: The chunks to output.
        N(RR`RRRR_R[(R&RR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR
s
	N(RyRzR{RR'RRR(((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRs,c@sfd}|S(s-Create a factory for creating a pack based groupcompress.

    This is only functional enough to run interface tests, it doesn't try to
    provide a full pack environment.

    :param graph: Store a graph.
    :param delta: Delta compress contents.
    :param keylength: How long should keys be.
    c		@s}d}rd}ntd|d}|jd}tj|j}|jt|dd|d|jd	}tj	i}|j
|||dft||}||_||_
|S(
Niitreference_liststkey_elementstnewpackcS@stS(N(R(((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt<lambda>*sRtadd_callbacktinconsistency_fatal(Rtopen_write_streamtpacktContainerWritertwritetbegint
_GCGraphIndext	add_nodest	pack_repot_DirectPackAccesst
set_writerRtstreamtwriter(	t	transportRt
ref_lengthtgraph_indexR*R+R7taccessRn(RHtgraphRt	keylength(s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR s$		
				((R0RHR1RR((RHR0RR1s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytmake_pack_factorys
cC@s|jj|jjdS(N(R+RLR*tclose(tversioned_files((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytcleanup_pack_group6s
t_BatchingBlockFetchercB@s8eZdZddZdZdZedZRS(sFetch group compress blocks in batches.

    :ivar total_bytes: int of expected number of bytes needed to fetch the
        currently pending batch.
    cC@sU||_||_g|_i|_g|_d|_d|_d|_||_	dS(Ni(
tgcvft	locationstkeystbatch_memostmemos_to_getttotal_bytesRtlast_read_memoRR(R&R7R8R((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR'Bs								cC@s|jj||j|\}}}}|dd!}||jkrL|jSy|jj|}WnGtk
rd|j|<|j	j||d}|j|7_nX||j|<|jS(sAdd another to key to fetch.

        :return: The estimated number of bytes needed to fetch the batch so
            far.
        iiiN(
R9R]R8R:R<R7t_group_cacheRRR;(R&Rt
index_memot_t	read_memotcached_blocktbyte_length((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytadd_keyMs




cc@sG|jdk	rCx|jjD]}|VqWd|_d|_ndS(N(RRRR=(R&R((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_flush_manageros
		cc@s|jdkr|jrdS|jj|j}t|j}|jx#|jD]}|j|\}}}}|d }|j	|krAx|j
D]}	|	VqW|r|d|kr|j\}
}|
|krtd|
|fn||j
|<|jn
|j
|}t|d|j|_||_	n|dd!\}}
|jj||||
qUW|rx|j
D]}	|	VqWn|j2|j
j|j2d|_dS(sJYield factories for keys added since the last yield.  They will be
        returned in the order they were added via add_key.

        :param full_flush: by default, some results may not be returned in case
            they can be part of the next batch.  If full_flush is True, then
            all results are returned.
        Niis4block_read_memo out of sync with read_memo(%r != %r)Rii(RRR9R7t_get_blocksR;tlisttreverseR8R=REtnextR+R:RRRRtclearR<(R&t
full_flushtblockstmemos_to_get_stackRR?R@RRARtblock_read_memoRRKRL((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytyield_factoriesvs@

	


	
N(	RyRzR{RR'RDRERRO(((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR6;s
	"	RcB@sDeZdZdZied6ZedddZdZddde	edZ
de	dZdZdZ
d	Zddd
ZdZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZe	dedZ ddZ!dZ"RS( s5A group-compress based VersionedFiles implementation.iRcC@sv||_||_||_|dkr0i}n||_|dkrWtdd}n||_g|_d|_dS(sxCreate a GroupCompressVersionedFiles object.

        :param index: The index object storing access and graph data.
        :param access: The access object storing raw data.
        :param delta: Whether to delta compress or just entropy compress.
        :param _unadded_refs: private parameter, don't use.
        :param _group_cache: private parameter, don't use.
        tmax_sizei2iNii (	t_indext_accesst_deltaRt
_unadded_refsRR>t_immediate_fallback_vfst_max_bytes_to_index(R&R7R/RHRTR>((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR's
							cC@s1t|j|j|jdt|jd|jS(s?Return a clone of this object without any fallbacks configured.RTR>(RRQRRRStdictRTR>(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytwithout_fallbackssc	C@s|jj|j|||||dkr8d}nttt|}	t||d|}
t|j	|
gd|d|d}||	dfS(sAdd a text to the store.

        :param key: The key tuple of the text to add.
        :param parents: The parents key tuples of the text to add.
        :param lines: A list of lines. Each line must be a bytestring. And all
            of them except the last must be terminated with \n and contain no
            other \n's. The last line may either contain no \n's or a single
            terminating \n. If the lines list does meet this constraint the
            add routine may error or may succeed - but you will be unable to
            read the data back accurately. (Checking the lines have been split
            correctly is expensive and extremely unlikely to catch bugs so it
            is not done at runtime unless check_content is True.)
        :param parent_texts: An optional dictionary containing the opaque
            representations of some or all of the parents of version_id to
            allow delta optimisations.  VERY IMPORTANT: the texts must be those
            returned by add_lines or data corruption can be caused.
        :param left_matching_blocks: a hint about which areas are common
            between the text and its left-hand-parent.  The format is
            the SequenceMatcher.get_matching_blocks format.
        :param nostore_sha: Raise ExistingContent and do not add the lines to
            the versioned file if the digest of the lines matches this.
        :param random_id: If True a random id has been selected rather than
            an id determined by some deterministic process such as a converter
            from a foreign VCS. When True the backend may choose not to check
            for uniqueness of the resulting key within the versioned file, so
            this should only be done when the result is expected to be unique
            anyway.
        :param check_content: If True, the lines supplied are verified to be
            bytestrings that are correctly formed lines.
        :return: The text sha1, the number of bytes in the text, and an opaque
                 representation of the inserted version which can be provided
                 back to future add_lines calls in the parent_texts dictionary.
        t	random_idRiN((
RQt_check_write_okt
_check_addRR_R[RRRGt_insert_record_stream(R&RRRtparent_textstleft_matching_blocksRRYt
check_contentRUtrecordRM((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt	add_liness$
	c	C@s|jj|j|d|dt|jtk	rGtjdn|dkr\d}nt	|}t
||d|}t|j|gd|d|d}||dfS(sSee VersionedFiles._add_text().R_RpRYRiN((
RQRZR[RRRRRtBzrBadParameterUnicodeRRRGR\(	R&RRRpRRYRUR`RM((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt	_add_texts
	cC@s|jj|dS(s~Add a source of texts for texts not present in this knit.

        :param a_versioned_files: A VersionedFiles object.
        N(RUR](R&ta_versioned_files((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytadd_fallback_versioned_filesscC@stj|}|j|S(sSee VersionedFiles.annotate.(tannotatet	Annotatort
annotate_flat(R&Rtann((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRfscC@s
tj|S(N(RfRg(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt
get_annotator$scC@s_|dkrH|j}x@|j|dtD]}|jdq.Wn|j|dtSdS(sSee VersionedFiles.check().t	unorderedRFN(RR9RRR(R&tprogress_barR9R`((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytcheck's
cC@s1|jj|jjj|jjjdS(s See VersionedFiles.clear_cache()N(R>RJRQt_graph_indextclear_cachet
_int_cache(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRo0s
cC@sq|d}|dk	r=tj|r=tj||q=n|j||rm|j||j|ndS(s0check that version_id and lines are safe to add.iN(RRtcontains_whitespaceRtInvalidRevisionIdtcheck_not_reserved_idt_check_lines_not_unicodet_check_lines_are_lines(R&RRRYR_t
version_id((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR[6s


cC@s|j|dS(sGet a map of the graph parents of keys.

        :param keys: The keys to look up parents for.
        :return: A mapping from keys to parents. Absent keys are absent from
            the mapping.
        i(t_get_parent_map_with_sources(R&R9((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytget_parent_mapEscC@si}|jg|j}g}t|}xT|D]L}|sBPn|j|}|j||j||jt|q2W||fS(sGet a map of the parents of keys.

        :param keys: The keys to look up parents for.
        :return: A tuple. The first element is a mapping from keys to parents.
            Absent keys are absent from the mapping. The second element is a
            list with the locations each key was found in. The first element
            is the in-this-knit parents, the second the first fallback source,
            and so on.
        (RQRUtsetRxR]tupdatetdifference_update(R&R9Rntsourcestsource_resultstmissingRt
new_result((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRwNs



c	c@s/i}x=|D]5}y|j|}Wntk
r7q
X|||<q
Wg}t}xL|D]D}||krtq\n||krq\n|j||j|q\W|jj|}xr|D]j}y|||fVWqtk
r&|j}tj	|}||j|<|||<||fVqXqWdS(sGet GroupCompressBlocks for the given read_memos.

        :returns: a series of (read_memo, block) pairs, in the order they were
            originally passed.
        N(
R>RRyR]taddRRtget_raw_recordsRIRRD(	R&t
read_memostcachedRARt
not_cachedtnot_cached_seentraw_recordstzdata((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRFes4

	





cC@stS(sReturn the keys of missing compression parents.

        Missing compression parents occur when a record stream was missing
        basis texts, or a index was scanned that had missing basis texts.
        (t	frozenset(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt#get_missing_compression_parent_keysscc@st|}t|}|s"dS|jjrD|dkrDd}n|}xtryLt|}x5|j||||D]}|j|j|Vq{WdSWqMtj	k
r}|j
j|qMXqMWdS(sGet a stream of records for keys.

        :param keys: The keys to include.
        :param ordering: Either 'unordered' or 'topological'. A topologically
            sorted stream has compression parents strictly before their
            children.
        :param include_delta_closure: If True then the closure across any
            compression parents will be included (in the opaque data).
        :return: An iterator of ContentFactory objects, each of which is only
            valid until the iterator is advanced.
        Nttopologicalt
groupcompressRk(RR(RGRyRQt	has_graphRt_get_remaining_record_streamtdiscardRRtRetryWithNewPacksRRtreload_or_raise(R&R9torderingtinclude_delta_closuret	orig_keystremaining_keystcontent_factoryte((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRs$

			c@si}i}g}x|jD]u|s,Pnj|}|j|t|}|j|f|jfd|D|j|qW|||fS(sFind whatever keys you can from the fallbacks.

        :param missing: A set of missing keys. This set will be mutated as keys
            are found from a fallback_vfs
        :return: (parent_map, key_to_source_map, source_results)
            parent_map  the overall key => parent_keys
            key_to_source_map   a dict from {key: source}
            source_results      a list of (source: keys)
        c3@s|]}|fVqdS(N((RR(R(s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pys	<genexpr>s(RURxRzRGR]R{(R&R~Rtkey_to_source_mapR}tsource_parents((Rs8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_find_from_fallbacks

c	C@s|dkrtj|}nt|}g}d}x]|D]U}|j||}||k	r}|j|gf|}n|ddj|q=W|S(ssGet the (source, [keys]) list.

        The returned objects should be in the order defined by 'ordering',
        which can weave between different sources.

        :param ordering: Must be one of 'topological' or 'groupcompress'
        :return: List of [(source, [keys])] tuples, such that all keys are in
            the defined order, regardless of source.
        RiiN(RRRRRR](	R&RRRRtsource_keystcurrent_sourceRR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_get_ordered_source_keyss

	c	C@sg}d}x|D]}||ks1||kr:|}n||kr||}nq||k	r~|j|gf|}n|ddj|qW|S(Nii(RR](	R&RR8tunadded_keysRRRRR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_get_as_requested_source_keyss
	
	c@sWfd}tjd|}t||}||fg}|j||S(Nc@s|dS(Ni((R(R8(s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt	get_groupsR(RtiterkeysRGR(R&R8Rt
source_resultRRR((R8s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_get_io_ordered_source_keyss
cc@s|jj|}t|jj|}|j|}|j||j|\}}	}
|dkrtd|j	D}x|D]}|j|||<qW|j
||j|||	}
n<|dkr|j||||	}
n|j
|||
}
x|D]}t|VqWt||d|j}x|
D]\}}||krx|D]}||jkrx|jdtD]}|VqW|jj|\}}|j|}t||||Vqcn|j|tkrcx|jD]}|VqWqcqcWqDx|jdtD]}|Vq'Wx"|j|||D]}|VqLWqDWx|jdtD]}|VqrWdS(	sGet a stream of records for keys.

        :param keys: The keys to include.
        :param ordering: one of 'unordered', 'topological', 'groupcompress' or
            'as-requested'
        :param include_delta_closure: If True then the closure across any
            compression parents will be included (in the opaque data).
        :return: An iterator of ContentFactory objects, each of which is only
            valid until the iterator is advanced.
        RRcs@s%|]\}}||dfVqdS(iN((RRtdetails((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pys	<genexpr>$ssas-requestedRRKN(stopologicals
groupcompress(RQtget_build_detailsRyRTtintersectiont
differenceR{RRWRRzRRRRR6RRORt_compressorRSRRDt
BATCH_SIZER(R&R9RRRR8RR~tfallback_parent_mapRRRRRtbatcherRRR9RMRR`((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR
sT

	

		

	
	

cC@s}i}xp|j|dtD]Y}|jdkrD|j||j<q|jdkrtj|jd||j<qqW|S(sSee VersionedFiles.get_sha1s().RktabsentRFN(	RRRMRRRRRR(R&R9RnR`((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt	get_sha1sTs cC@s$x|j|dtD]}qWdS(sInsert a record stream into this container.

        :param stream: A stream of records to insert.
        :return: None
        :seealso VersionedFiles.get_record_stream:
        RYN(R\R(R&R*R@((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytinsert_record_stream`scC@s|jdkrtj}|jd}|dk	ryyt|}Wqytk
ru}tjd|fd}qyXn|dkr|j	}n||_ni|jd6S(Ns$bzr.groupcompress.max_bytes_to_indexsEValue for "bzr.groupcompress.max_bytes_to_index" %r is not an integerR(
RVRtconfigtGlobalConfigtget_user_optionR8RARtwarningt_DEFAULT_MAX_BYTES_TO_INDEX(R&RNtvalR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRns	
cC@st|jS(N(RR(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRsc$	#@sifd}j_i_gfd}d}d}d}	d}
d}d}t}
|}x>|D]6}|jdkrtj|jnr|j|
krt	j
td|jqn|
j|jn|r)|jdkr/|j
}
|
j}q/nt}|r@|jdkr|j
}
|j
jj}jjdt|fg|d\}}}~|}|}n|jdkr@|
dkrtdn|
|j
k	rtd	nd
|||j|jf}|j||jffg}jj|dqq@ny|jd}Wn>tjk
r|jdf}||}|j|}nXt|jd
kr|jd}||k}nd}t}|t|krt|}|}	njj|j||jd|d|\}}}}||	krS|d|krSt}nH|dkrht }n3|dk	r||kr|dkrt }nt}|}|rjj!|t|}jj|j||j\}}}}n|jddkr"|jd d|f}n	|j}|jj|<|Vt"j#j$} |jdk	r| g|jD]}!| |!^qh}"nd}"t"j#|"}#j%|d||f|#fqWtr|nd_dS(sInternal core to insert a record stream into this container.

        This helper function has a different interface than insert_record_stream
        to allow add_lines to be minimal, but still return the needed data.

        :param stream: A stream of records to insert.
        :param nostore_sha: If the sha1 of a given text matches nostore_sha,
            raise ExistingContent, rather than committing the new text.
        :param reuse_blocks: If the source is streaming from
            groupcompress-blocks, just insert the blocks as-is, rather than
            expanding the texts and inserting again.
        :return: An iterator over the sha1 of the inserted records.
        :seealso insert_record_stream:
        :seealso add_lines:
        c@sJy|SWn7tk
rEtj|}|}||<|SXdS(N(RRR(tadapter_keytadapter_factorytadapter(tadaptersR&(s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytget_adapters

c
@sjjj\}}j_dj|}~jjdt|fg|d\}}}g}x:D]2\}}}	|j	|d|||f|	fqzWj
j|di_2dS(NRis%d %d %sRY(
RR^RhRR,RRtadd_raw_recordsRRR]RQtadd_recordsRT(
t	bytes_lenR`R9R7RKRUtnodesRtreadstrefs(tkeys_to_addRYR&(s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR^s
	('	iRs=Insert claimed random_id=True, but then inserted %r two timessgroupcompress-blocksgroupcompress-block-refsNo insert_manager setsrinsert_manager does not match the current record, we cannot be positive that the appropriate content was inserted.s%d %d %d %dRYRFiRRiiiissha1:s%d %dN(sgroupcompress-blocksgroupcompress-block-refii@ii (&RRRTRRyRRtRevisionNotPresentRRtnotetgettextRRRRRRiRRRRR+RRRRQRRRt	get_bytesR\RMRRtstatic_tupletStaticTuplet
from_sequenceR]($R&R*RYRtreuse_blocksRR^tlast_prefixtmax_fulltext_lentmax_fulltext_prefixtinsert_managertblock_starttblock_lengtht
inserted_keystreuse_this_blockR`R9R@RKRURRRRRRRRRROtstart_new_blockRtas_sttpRR((RRRYR&s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR\s
		

			(				
				
	+$
c	c@st|}t|}xt|j|dtD]\}}|j}|dk	rk|jd||n|jdkrt	j
||ntj|j
d}x|D]}||fVqWq4W|dk	r|jd||ndS(sIterate over the lines in the versioned files from keys.

        This may return lines from other keys. Each item the returned
        iterator yields is a tuple of a line and a text version that that line
        is present in (not introduced in).

        Ordering of results is in whatever order is most suitable for the
        underlying storage format.

        If a progress bar is supplied, it may be used to indicate progress.
        The caller is responsible for cleaning up progress bars (because this
        is an iterator).

        NOTES:
         * Lines are normalised by the underlying store: they will all have 

           terminators.
         * Lines are returned in arbitrary order.

        :return: An iterator over (line, key).
        RksWalking contentRRFN(RyRt	enumerateRRRRRzRRRRRR(	R&R9tpbttotaltkey_idxR`RRtline((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt#iter_lines_added_or_present_in_keys1s	
cC@sfdtjkr"tjddn|jg|j}t}x!|D]}|j|jqEW|S(sSee VersionedFiles.keys.tevilis keys scales with size of history(	tdebugtdebug_flagsRtmutter_callsiteRQRURyRzR9(R&R|RnR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR9Ys	
iN(#RyRzR{RRRRR'RXRRaRcReRfRjRmRoR[RxRwRFRRRRRRRRRRRR\RR9(((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRsF

		0										%	
	#					G				(t_GCBuildDetailscB@sbeZdZdZdZdZdZd	Ze	d
Z
e	dZdZd
Z
RS(sA blob of data about the build details.

    This stores the minimal data, which then allows compatibility with the old
    api, without taking as much memory.
    RQt_group_startt
_group_endt
_basis_endt
_delta_endt_parentstgroupcC@s1||_|\|_|_|_|_|_dS(N(RRQRRRR(R&Rt
position_info((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR'qs	cC@sd|jj|j|jfS(Ns
%s(%s, %s)(RRyR?R(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRvscC@s"|j|j|j|j|jfS(N(RQRRRR(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR?zscC@stj|jdS(N(RRtmethodR(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytrecord_detailsscC@s\|dkr|jS|dkr&|jS|dkr9|jS|dkrL|jStddS(s(Compatibility thunk to act like a tuple.iiiisoffset out of rangeN(R?tcompression_parentRRt
IndexError(R&Rv((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt__getitem__scC@sdS(Ni((R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR(s(s_indexs_group_starts
_group_ends
_basis_ends
_delta_ends_parentsN(RyRzR{t	__slots__RRRR'RR}R?RRR((((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRds			
R%cB@seZdZed
eeedZedZdZdZ	edZ
dZdZdZ
d	Zd
ZdZdZRS(sFMapper from GroupCompressVersionedFiles needs into GraphIndex storage.cC@sg||_||_||_||_||_||_i|_|rZtd||_n	d|_dS(sConstruct a _GCGraphIndex on a graph_index.

        :param graph_index: An implementation of bzrlib.index.GraphIndex.
        :param is_locked: A callback, returns True if the index is locked and
            thus usable.
        :param parents: If True, record knits parents, if not do not record
            parents.
        :param add_callback: If not None, allow additions to the index and call
            this callback with a list of added GraphIndex nodes:
            [(node, value, node_refs), ...]
        :param track_external_parent_refs: As keys are added, keep track of the
            keys they reference, so that we can query get_missing_parents(),
            etc.
        :param inconsistency_fatal: When asked to add records that are already
            present, and the details are inconsistent with the existing
            record, raise an exception instead of warning (and skipping the
            record).
        ttrack_new_keysN(
t
_add_callbackRnRRt
_is_lockedt_inconsistency_fatalRpRt_key_dependenciesR(R&R.t	is_lockedRRttrack_external_parent_refsRR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR's							cC@s|jstj|nt}i}xt|D]l\}}}|js|rx)|D]!}|rStj|dqSqSWd}t}qn||f||<q.W|s`|j|}	x|	D]\}
}}}tj	|}tj	||}||dkrLd|||f|f}
|j
r9tj|d|
qLtjd|
n||=t}qWn|rg}|jrxo|j
D](\}\}}|j|||fqWn6x3|j
D]%\}\}}|j||fqW|}n|j}|dk	ro|jrEx[|D])\}}}|d}|j||qWqox'|D]\}}}tj|qLWn|j|dS(	s7Add multiple records to the index.

        This function does not insert data into the Immutable GraphIndex
        backing the KnitGraphIndex, instead it prepares data for insertion by
        the caller and checks that it is safe to insert then calls
        self._add_callback with the prepared GraphIndex nodes.

        :param records: a list of tuples:
                         (key, options, access_memo, parents).
        :param random_id: If True the ids being added were randomly generated
            and no check for existence will be performed.
        s5attempt to add node with parents in parentless index.is%s %s %ss'inconsistent details in add_records: %ss*inconsistent details in skipped record: %siN((RRt
ReadOnlyErrorRRtKnitCorruptRt_get_entriesRt	as_tuplesRRRRR]RRtadd_referencestnew_keysRD(R&trecordsRYtchangedR9RRRtreft
present_nodesR7t	node_refstpassedRRntkey_dependenciesR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRsZ
		
		
	

				
cC@s"|jstj|ndS(s.Raise an exception if reads are not permitted.N(RRtObjectNotLocked(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt_check_readscC@s"|jstj|ndS(s/Raise an exception if writes are not permitted.N(RRR(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRZscc@st|}t}|jrTx~|jj|D]}|V|j|dq1WnKxH|jj|D]4}|d|d|ddfV|j|dqgW|r|j|}|rtj|j|qndS(sGet the entries for keys.

        Note: Callers are responsible for checking that the index is locked
        before calling this method.

        :param keys: An iterable of index key tuples.
        iiiN((	RyRRntiter_entriesRRRRR(R&R9t
check_presentt
found_keystnodetmissing_keys((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR
s		cC@s|jj|dS(s$See CombinedGraphIndex.find_ancestryi(Rnt
find_ancestry(R&R9((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR"scC@su|j|j|}i}|jrRxF|D]}|dd||d<q/Wnx|D]}d||d<qYW|S(sGet a map of the parents of keys.

        :param keys: The keys to look up parents for.
        :return: A mapping from keys to parents. Absent keys are absent from
            the mapping.
        iiiN(RRRR(R&R9RRnR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyRx&s
	

cC@s5|jj|j|jjt|jjS(s#Return the keys of missing parents.(Rtsatisfy_refs_for_keysRxtget_unsatisfied_refsR(R&((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytget_missing_parents8s	cC@s|ji}|j|}xZ|D]R}|d}|jsHd}n|dd}t||j|}|||<q&W|S(srGet the various build details for keys.

        Ghosts are omitted from the result.

        :param keys: An iterable of keys.
        :return: A dict of key:
            (index_memo, compression_parent, parents, record_details).

            * index_memo: opaque structure to pass to read_records to extract
              the raw data
            * compression_parent: Content that this record is built upon, may
              be None
            * parents: Logical parents of this node
            * record_details: extra information about the content which needs
              to be passed to Factory.parse_record
        iiiN(RRRRRt_node_to_position(R&R9RntentriestentryRRR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR@s


		cC@s.|jg|jjD]}|d^qS(sOGet all the keys in the collection.

        The keys are not ordered.
        i(RRntiter_all_entries(R&R((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR9^s
cC@s|djd}t|d}|jj||}t|d}|jj||}t|d}t|d}|d||||fS(s+Convert an index value to position details.it iii(RR8Rpt
setdefault(R&RtbitsRKtstopt	basis_endt	delta_end((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR
fscC@sP|j}|dkrdSx0|jD]"}|j|d|ddq&WdS(sIInform this _GCGraphIndex that there is an unvalidated index.

        This allows this _GCGraphIndex to keep track of any missing
        compression parents we may want to have filled in to make those
        indices valid.  It also allows _GCGraphIndex to track any new keys.

        :param graph_index: A GraphIndex
        Niii(RRR
R(R&R.RR((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pytscan_unvalidated_index}s
		N(RyRzR{RRRR'RRRZRRRxR	RR9R
R(((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyR%s"E								(RRJRRIRlR(RRJRRRI(4R{t
__future__RRR*tbzrlib.lazy_importRtglobalstbzrlib.btree_indexRtbzrlib.lru_cacheRtbzrlib.versionedfileRRRRRR	RRRR0tobjectRRRRRRRRR2R5R6RRR%tbzrlib._groupcompress_pyRRJRRIRlRtbzrlib._groupcompress_pyxRRtImportErrorRRtfailed_to_load_extension(((s8/usr/lib/python2.7/dist-packages/bzrlib/groupcompress.pyt<module>sJ	.
	
7A<	-N 	n0.(



Copyright © 2017 || Recoded By Mr.Bumblebee