-=[ Mr. Bumblebee ]=-
_Indonesia_

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

ó
î:ïNc@@s•dZddlmZddlmZdefd„ƒYZdefd„ƒYZd„Zd	„Z	d
„Z
d„Zd„Zd
„Z
d„ZdS(s™Python version of compiled extensions for doing compression.

We separate the implementation from the groupcompress.py to avoid importing
useless stuff.
i(tabsolute_import(tosutilst_OutputHandlercB@s;eZdZd„Zd„Zd„Zd„Zd„ZRS(sCA simple class which just tracks how to split up an insert request.cC@s1||_||_||_g|_d|_dS(Ni(t	out_linestindex_linestmin_len_to_indextcur_insert_linestcur_insert_len(tselfRRR((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyt__init__s
				cC@scx\t||dƒD]H}td||ƒ}t||ƒ}|jj|ƒ|jjtƒqWdS(Ni@iii(txrangetmintencode_copy_instructionRtappendRtFalse(Rt
start_bytetend_bytet	num_bytest
copy_bytes((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pytadd_copy&s
cC@sÒ|js
dS|jdkr+tdƒ‚n|jjt|jƒƒ|jjtƒ|jj|jƒ|j|j	krœ|jjtgt
|jƒƒn |jjtgt
|jƒƒg|_d|_dS(Nis/We cannot insert more than 127 bytes at a time.i(RRtAssertionErrorRR
tchrRRtextendRtlentTrue(R((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyt
_flush_insert/s	# 	cC@s›|jƒt|ƒ}x~td|dƒD]j}td||ƒ}|jjt|ƒƒ|jjtƒ|jj||||!ƒ|jjtƒq)WdS(Nii(	RRR
RRR
RRR(Rtlinetline_lentstart_indextnext_len((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyt_insert_long_line?s
cC@s¿|jgkrtdƒ‚nx|D]ˆ}t|ƒdkrM|j|ƒq%t|ƒ|j}|dkr”|jƒ|g|_t|ƒ|_q%|jj|ƒ||_q%W|jƒdS(Ns<self.cur_insert_lines must be empty when adding a new inserti(RRRRRRR
(RtlinesRR((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyt
add_insertLs


(t__name__t
__module__t__doc__R	RRRR (((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyRs					
tLinesDeltaIndexcB@steZdZdZdZd„Zd„Zd„Zd„Ze	d„Z
d„Zd	„Zd
„Z
de	d„ZRS(
sThis class indexes matches between strings.

    :ivar lines: The 'static' lines that will be preserved between runs.
    :ivar _matching_lines: A dict of {line:[matching offsets]}
    :ivar line_offsets: The byte offset for the end of each line, used to
        quickly map between a matching line number and the byte location
    :ivar endpoint: The total number of bytes in self.line_offsets
    i
iÈcC@sEg|_g|_d|_i|_|j|tgt|ƒƒdS(Ni(Rtline_offsetstendpointt_matching_linestextend_linesRR(RR((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyR	ms
				cC@sÐ|j}t|jƒ}t|ƒt|ƒkrUtdt|ƒt|ƒfƒ‚nxtt|ƒD]f\}}|szqbn||}y||j||ƒWqbtk
rÇt||gƒ||<qbXqbWdS(NsVThe number of lines to be indexed does not match the index/don't index flags: %d != %d(R'RRRt	enumeratetaddtKeyErrortset(Rt	new_linestindextmatchest	start_idxtidxtdo_indexR((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyt_update_matching_linests	

cC@s(y|j|SWntk
r#dSXdS(s/Return the lines which match the line in right.N(R'R+tNone(RR((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pytget_matches„s
cC@s|}d}d}t|ƒ}|j}x¸||kráy|||}Wntk
rf|d7}PnX|dkrˆ|}d}d}nL|jg|D]}	|	d^q•ƒ}
|
rÓt|
ƒ}|d7}d}nP|d7}q*W|dkrød|fSt|ƒ}||d||f|fS(sfLook at all matches for the current line, return the longest.

        :param lines: The lines we are matching against
        :param pos: The current location we care about
        :param locations: A list of lines that matched the current location.
            This may be None, but often we'll have already found matches for
            this line.
        :return: (start_in_self, start_in_lines, num_lines)
            All values are the offset in the list (aka the line number)
            If start_in_self is None, then we have no matches, and this line
            should be inserted in the target.
        iiN(R4RR'R+tintersectionR,R(RRtpostrange_startt	range_lentprev_locationstmax_postmatchingt	locationstloctnext_locationstsmallest((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyt_get_longest_match‹s6
	

		
	
c
C@sg}d}t|ƒ}|j}|j}|r<|j}nx§||krå|j||ƒ\}}|dk	rÉ|d|krÉ|\}	}
}ttt||
|
|!ƒƒ}||krÆd}qÆqÉn|dk	r?||ƒq?q?W|t|jƒt|ƒdfƒ|S(s˜Return the ranges in lines which match self.lines.

        :param lines: lines to compress
        :return: A list of (old_start, new_start, length) tuples which reflect
            a region in self.lines that is present in lines.  The last element
            of the list is always (old_len, new_len, 0) to provide a end point
            for generating instructions from the matching blocks list.
        iiÿÿÿÿN(	RR
t_MIN_MATCH_BYTESt_SOFT_MIN_MATCH_BYTESRAR4tsumtmapR(
RRtsofttresultR7R;t
result_appendtmin_match_bytestblockt	old_startt	new_startR9t
matched_bytes((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pytget_matching_blocksÂs(			"cC@s”|j||ƒ|jj|ƒ|j}x.|D]&}|t|ƒ7}|jj|ƒq0Wt|jƒt|jƒkr‡tdƒ‚n||_dS(s½Add more lines to the left-lines list.

        :param lines: A list of lines to add
        :param index: A True/False for each node to define if it should be
            indexed.
        sHSomehow the line offset indicator got out of sync with the line counter.N(R3RRR&RR%R
R(RRR.R&R((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyR(ës	
cC@s½dj|||!ƒ}t|ƒ}x”td|dƒD]€}t||dƒ}	|jt|	ƒƒ|jtƒ||||	!}
tj|
ƒ}|j	|ƒ|j	t
gt|ƒƒq5WdS(s+Add an 'insert' request to the data stream.tiiN(tjoinRR
RR
RRRtsplit_linesRR(Rt
start_linenumtend_linenumR-RRtbytes_to_insertt
insert_lengthRtinsert_counttinserttas_lines((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyRýs

c
C@s¢|dkrd}n|j|d}|j||d}||}xVt||dƒD]B}td||ƒ}t||ƒ}	|j|	ƒ|jtƒqXWdS(Niii@iii(R%R
RRR
R(
Rtold_start_linenumt	num_linesRRt
first_bytet	stop_byteRRR((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyt_flush_copy
s	

cC@s|dkr$ttt|ƒƒ}nddt|ƒg}tttg}t|||jƒ}|j|d|ƒ}d}x˜|D]\}	}
}|
|kr±|j	|||
!ƒn|
|}|r|	dkrÖd}n|j
|	d}|j
|	|d}
|j||
ƒqqW||fS(s?Compute the delta for this content versus the original content.RORFiiN(R4RDRERtencode_base128_intRRRBRNR R%R(RR-tbytes_lengthRFRRtoutput_handlertblockstcurrent_line_numRKRLR9R[t	last_byte((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyt
make_deltas&	
	N(R!R"R#RBRCR	R3R5RARRNR(RR]R4Rd(((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyR$`s				7)			cC@sdg}d}x5|dkrC|jt|dBd@ƒƒ|dL}qW|jt|ƒƒdj|ƒS(s-Convert an integer into a 7-bit lsb encoding.ii€iÿiRO(R
RRP(tvaltbytestcount((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyR^:scC@sd}d}d}t||ƒ}xF|dkrj||d@|>O}|d7}|d7}t||ƒ}q%W|||>O}|d7}||fS(s,Decode an integer from a 7-bit lsb encoding.ii€iii(tord(RftoffsetRetshifttbval((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pytdecode_base128_intEs


cC@s"d}dg}xHdD]@}|d@}|rL||O}|jt|ƒƒn|dL}qW|dkrutdƒ‚n|dkrtd	ƒ‚n|d
kr«tdƒ‚n|dkrxKdD]@}|d@}|rô||O}|jt|ƒƒn|dL}q¾Wnt|ƒ|d
<dj|ƒS(s2Convert this offset into a control code and bytes.i€iiiiiÿscannot supply a length of Noneis.we don't emit copy records for lengths > 64KiBis!We cannot emit a copy of length 0ii RON(iiii(ii (R4R
Rt
ValueErrorRP(Ritlengthtcopy_commandRtcopy_bitt	base_byte((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyRUs.	





cC@s†|d@dkrtdƒ‚nd}d}|d@rRt||ƒ}|d7}n|d@r|t||ƒd>B}|d7}n|d@r°|t||ƒd>B}|d7}n|d@rß|t||ƒd	>B}|d7}n|d@rt||ƒ}|d7}n|d
@r5|t||ƒd>B}|d7}n|d@rd|t||ƒd>B}|d7}n|dkryd}n|||fS(
s#Decode a copy instruction from the next few bytes.

    A copy instruction is a variable number of bytes, so we will parse the
    bytes we care about, and return the new position, as well as the offset and
    length referred to in the bytes.

    :param bytes: A string of bytes
    :param cmd: The command code
    :param pos: The position in bytes right after the copy command
    :return: (offset, length, newpos)
        The offset of the copy start, the number of bytes to copy, and the
        position after the last byte of the copy
    i€s(copy instructions must have bit 0x80 setiiiiiiii i@i(RmRh(RftcmdR7RiRn((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pytdecode_copy_instructionss8













	cC@sŽt|ƒtk	r!tdƒ‚nt|ƒtk	rBtdƒ‚nttj|ƒƒ}|jtj|ƒdt|ƒƒ\}}dj|ƒS(s%Create a delta from source to target.ssource is not a strstarget is not a strR_RO(	ttypetstrt	TypeErrorR$RRQRdRRP(tsource_bytesttarget_bytestline_locationstdeltat_((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyRdŸscC@s{t|ƒtk	r!tdƒ‚nt|ƒtk	rBtdƒ‚nt|ƒ\}}g}t|ƒ}xÎ||kr6t||ƒ}|d7}|d@röt|||ƒ\}}}||}	|	t|ƒkrßtdƒ‚n|j|||	!ƒqi|dkrtdƒ‚n|j||||!ƒ||7}qiWdj	|ƒ}
t|
ƒ|krwtd	|t|
ƒfƒ‚n|
S(
s4Apply delta to this object to become new_version_id.sbasis is not a strsdelta is not a strii€s+data would copy bytes past theend of sourceisCommand == 0 not supported yetROs1Delta claimed to be %d long, but ended up %d long(
RtRuRvRlRRhRsRmR
RP(tbasisRzt
target_lengthR7Rt	len_deltaRrRiRntlastRf((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pytapply_delta«s2


cC@swt|ƒ}||kr'tdƒ‚n||krBtdƒ‚n||kr]tdƒ‚n|||!}t||ƒS(s0Extract a delta from source bytes, and apply it.sdelta starts after sourcesdelta ends after sourcesdelta starts after it ends(RRmR€(tsourcetdelta_startt	delta_endtsource_sizetdelta_bytes((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pytapply_delta_to_sourceÊs
N(R#t
__future__RtbzrlibRtobjectRR$R^RlRRsRdR€R†(((s</usr/lib/python2.7/dist-packages/bzrlib/_groupcompress_py.pyt<module>sDÚ				,		

Copyright © 2017 || Recoded By Mr.Bumblebee