-=[ Mr. Bumblebee ]=-
_Indonesia_

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


:Nc@@sodZddlmZdddddgZddlmZdd	lmZdd
lZdd
l	Z	ddl
mZeeddd
l
mZmZddlmZddfZdZdZdZdZejdZejdZdZdZdefdYZdefdYZdefdYZdefdYZ defdYZ!d
S(sIndexing facilities.i(tabsolute_importtCombinedGraphIndext
GraphIndextGraphIndexBuildertGraphIndexPrefixAdaptertInMemoryGraphIndex(tbisect_right(tStringION(tlazy_importsX
from bzrlib import (
    bisect_multi,
    revision as _mod_revision,
    trace,
    )
(tdebugterrors(tStaticTupleis
key_elements=slen=snode_ref_lists=sBazaar Graph Index 1
s	[	

 ]s[
]cC@s||j|gkS(sCheck if this index has one key.

    If it's possible to check for multiple keys at once through
    calling get_parent_map that should be faster.
    (tget_parent_map(tselftkey((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt_has_key_from_parent_map;scC@st|t|j|S(N(tsetR(R
tkeys((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt_missing_keys_from_parent_mapDscB@seZdZdddZdZdZdZdZdZdd	Z	d
Z
dZdddZ
d
ZRS(sA builder that can build a GraphIndex.

    The resulting graph has the structure::

      _SIGNATURE OPTIONS NODES NEWLINE
      _SIGNATURE     := 'Bazaar Graph Index 1' NEWLINE
      OPTIONS        := 'node_ref_lists=' DIGITS NEWLINE
      NODES          := NODE*
      NODE           := KEY NULL ABSENT? NULL REFERENCES NULL VALUE NEWLINE
      KEY            := Not-whitespace-utf8
      ABSENT         := 'a'
      REFERENCES     := REFERENCE_LIST (TAB REFERENCE_LIST){node_ref_lists - 1}
      REFERENCE_LIST := (REFERENCE (CR REFERENCE)*)?
      REFERENCE      := DIGITS  ; digits is the byte offset in the index of the
                                ; referenced key.
      VALUE          := no-newline-no-null-bytes
    iicC@sF||_i|_t|_d|_||_t|_t	|_
dS(sCreate a GraphIndex builder.

        :param reference_lists: The number of node references lists for each
            entry.
        :param key_elements: The number of bytestrings in each key.
        N(treference_listst_nodesRt_absent_keystNonet
_nodes_by_keyt_key_lengthtFalset_optimize_for_sizetTruet_combine_backing_indices(R
Rtkey_elements((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt__init__[s					cC@st|ttfkr*tj|n|jt|krQtj|nx<|D]4}|sztj|dk	rXtj|qXqXWdS(s;Raise BadIndexKey if key is not a valid key for this index.N(
ttypettupleRR
tBadIndexKeyRtlent_whitespace_retsearchR(R
Rtelement((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt
_check_keyls
cC@sqt}t}|jdkrfx:|jD],}|j|d|j|ddq.W||StSdS(s>Return references that are not present in this index.
        iiN(RRtiter_all_entriestaddtupdate(R
Rtrefstnode((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt_external_referencesvs		cC@s#|jdkri}|jrx|jjD]e\}\}}}|rOq.n|}x$|d D]}|j|i}q`W|||f||d<q.Wnvxs|jjD]b\}\}}}|rqn|}x$|d D]}|j|i}qW||f||d<qW||_n|jS(Ni(RRRRt	iteritemst
setdefault(R
tnodes_by_keyRtabsentt
referencestvaluetkey_dicttsubkey((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt_get_nodes_by_keys&	%%cC@s|jdkrdS|j}|jr:t|||}nt||}x$|d D]}|j|i}qTW|||d<dS(sUpdate the _nodes_by_key dict with a new key.

        For a key of (foo, bar, baz) create
        _nodes_by_key[foo][bar][baz] = key_value
        Ni(RRRRR.(R
RR2t	node_refsR3t	key_valueR4((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt_update_nodes_by_keys		c
C@stj}|j|tj|dk	r=tj|nt||j	krdtj|ng}g}x|D]{}x:|D]2}||j
kr|j||j|qqW|g|D]}	||	j^q}|j|qwW|||fS(sACheck that 'key' and 'references' are all valid.

        :param key: A key tuple. Must conform to the key interface (be a tuple,
            be of the right length, not have any whitespace or nulls in any key
            element.)
        :param references: An iterable of reference lists. Something like
            [[(ref, key)], [(ref, key), (other, key)]]
        :param value: The value associate with this key. Must not contain
            newlines or null characters.
        :return: (node_refs, absent_references)
        
            * node_refs: basically a packed form of 'references' where all
              iterables are tuples
            * absent_references: reference keys that are not in self._nodes.
              This may contain duplicates if the same key is referenced in
              multiple lists.
        N(
Rt
from_sequenceR&t_newline_null_reR$RR
t
BadIndexValueR"RRtappendtintern(
R
RR1R2tas_stR6tabsent_referencestreference_listt	referencetref((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt_check_key_ref_values"	



%cC@s|j|||\}}||jkrV|j|ddkrVtj||nx$|D]}dddf|j|<q]W|jj||jj|d||f|j|<|jdk	r|j	dkr|j
|||ndS(sAdd a node to the index.

        :param key: The key. keys are non-empty tuples containing
            as many whitespace-free utf8 bytestrings as the key length
            defined for this index.
        :param references: An iterable of iterables of keys. Each is a
            reference to another key.
        :param value: The value to associate with the key. It may be any
            bytes as long as it does not contain \0 or \n.
        itatiN((RCRR
tBadIndexDuplicateKeyRR)tdiscardRRRR8(R
RR2R1R6R?RA((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pytadd_nodes&
cC@sdS(sSee GraphIndex.clear_cache()

        This is a no-op, but we need the api to conform to a generic 'Index'
        abstraction.
        N((R
((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pytclear_cachescC@sgtg}|jtt|jd|jtt|jdt|jt|j	}|jt
t|dtd|D}t|jj
}d}|jrMg}|}d}x|D]\}	\}
}}|j|	||f|td|	D7}|jdkr7||jd7}n|t|dd7}|
rb|d7}q|jr||jd7}x>|D]3}
|t|
7}|
r|t|
d7}qqWqqWd}|||}x,d||kr|d7}|||}qW|d}i}x)|D]!\}	}}|||||	<qWd|}nx|D]\}	\}
}}g}xP|D]H}
g}x#|
D]}|j|||qW|jd	j|qvWd
j|	}|jd||
dj||fqTW|jdtd
j|}|rct|j|krctjdt|j|fn|S(sFinish the index.

        :returns: cStringIO holding the full context of the index as it 
        should be written to disk.
        s
cs@s|]}t|VqdS(N(R"(t.0tx((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pys	<genexpr>sics@s|]}t|VqdS(N(R"(RJR%((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pys	<genexpr>$siii
s%%0%sds
ts%s%s%s%s
s	REsZFailed index creation. Internal error: mismatched output length and expected length: %d %dN(t
_SIGNATURER<t_OPTION_NODE_REFStstrRt_OPTION_KEY_ELEMENTSRR"RRt_OPTION_LENtsumtsortedtitemsRtjoinRtgetvalueR
tBzrError(R
tlinest	key_countt
prefix_lengthtnodestexpected_bytestkey_offset_infot
non_ref_bytesttotal_referencesRR0R1R2tref_listtdigitstpossible_total_bytest
key_addressest
format_stringtflattened_referencest
ref_addressesRAt
string_keytresult((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pytfinishsh		
	
"





	cC@s4|dk	r||_n|dk	r0||_ndS(sChange how the builder tries to optimize the result.

        :param for_size: Tell the builder to try and make the index as small as
            possible.
        :param combine_backing_indices: If the builder spills to disk to save
            memory, should the on-disk indices be combined. Set to True if you
            are going to be probing the index, but to False if you are not. (If
            you are not querying, then the time spent combining is wasted.)
        :return: None
        N(RRR(R
tfor_sizetcombine_backing_indices((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pytset_optimizeUs
c
C@st|}i}t}x|rt}xy|j|D]h\}}}	}
|
|}|||<|jg|D]}||krp|^qp|j|j|q=W|}qW||fS(s&See CombinedGraphIndex.find_ancestry()(Rtiter_entriesR)t
difference(
R
Rtref_list_numtpendingt
parent_maptmissing_keystnext_pendingt_RR2t	ref_liststparent_keystp((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt
find_ancestrygs			"


(N(t__name__t
__module__t__doc__RR&R,R5R8RCRHRIRiRRlRx(((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRHs	
				&		\cB@seZdZeddZdZdZdZddZ	dZ
dZd	Zd
Z
dZdZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!RS( s>An index for data with embedded graphs.

    The index maps keys to a list of key reference lists, and a value.
    Each node has the same number of key reference lists. Each key reference
    list can be empty or an arbitrary length. The value is an opaque NULL
    terminated string without any newlines. The storage of the index is
    hidden in the interface: keys and key references are always tuples of
    bytestrings, never the internal representation (e.g. dictionary offsets).

    It is presumed that the index will not be mutated - it is static data.

    Successive iter_all_entries calls will read the entire index each time.
    Additionally, iter_entries calls will read the index linearly until the
    desired keys are found. XXX: This must be fixed before the index is
    suitable for production use. :XXX
    icC@sp||_||_d|_d|_g|_g|_d|_d|_d|_	||_
d|_||_dS(sOpen an index called name on transport.

        :param transport: A bzrlib.transport.Transport.
        :param name: A path to provide to transport API calls.
        :param size: The size of the index in bytes. This is used for bisection
            logic to perform partial index reads. While the size could be
            obtained by statting the file this introduced an additional round
            trip as well as requiring stat'able transports, both of which are
            avoided by having it supplied. If size is None, then bisection
            support will be disabled and accessing the index will just stream
            all the data.
        :param offset: Instead of starting the index data at offset 0, start it
            at an arbitrary offset.
        iN(
t
_transportt_nameRt
_bisect_nodesRt_parsed_byte_mapt_parsed_key_mapt
_key_countt_keys_by_offsetRt_sizet_bytes_readt_base_offset(R
t	transporttnametsizetunlimited_cachetoffset((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRs											cC@sLt|t|koK|j|jkoK|j|jkoK|j|jkS(s@Equal when self and other were created with the same parameters.(RR|R}R(R
tother((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt__eq__scC@s|j|S(N(R(R
R((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt__ne__scC@s#d|jj|jj|jfS(Ns%s(%r)(t	__class__RyR|tabspathR}(R
((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt__repr__scC@s|jdk	rdSdtjkrDtjd|jj|jn|dkr|jj	|j}|j
dkrt|j|j
}qn|j
|d|j|_d}i|_i|_d|_d}|j}|jjd}|j|d=|j||\}}}}xc|jjD]R\}}}	}
|rUq7n|jrv|
|j|	f}n|
}||j|<q7W|dkrtj|ndS(	sYBuffer all the index data.

        Mutates self._nodes and self.keys_by_offset.
        NtindexsReading entire index %siis
ii(RRR	tdebug_flagsttracetmutterR|RR}tgetRRtreadt_read_prefixRt_expected_elementsRRttelltsplittcloset_parse_linest
itervaluestnode_ref_listst_resolve_referencesR
tBadIndexData(R
tstreamt
line_countttrailerstposRXRtRR0R1R2t
node_value((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt_buffer_alls<	
			
"	cC@sdS(sClear out any cached/memoized values.

        This can be called at any time, but generally it is used when we have
        extracted some information, but don't expect to be requesting any more
        from this index.
        N((R
((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRIsc	C@s|j|d|jkr9td||jfnt}|j}xV|jD]H\}\}}||}|jg|D]}||kr|^qqXW|S(s>Return references that are not present in this index.
        is&No ref list %d, index has %d ref lists(RRt
ValueErrorRRR-R)(	R
RoR*R[RR2RuR`RB((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pytexternal_referencess
		
0cC@s|jdkri}|jrx|jjD]V\}\}}|}x$|d D]}|j|i}qQW|||f||d<q.Wnax^|jjD]M\}}|}x$|d D]}|j|i}qW||f||d<qW||_n|jS(Ni(RRRRR-R.(R
R/RR2R1R3R4((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR5s	"cc@sdtjkr"tjddn|jdkr>|jn|jrxe|jjD]#\}\}}||||fVqWWn.x+|jjD]\}}|||fVqWdS(sIterate over all keys within the index.

        :return: An iterable of (index, key, value) or (index, key, value, reference_lists).
            The former tuple is used when there are no reference lists in the
            index, making the API compatible with simple key:value index types.
            There is no defined order for the result iteration - it will be in
            the most efficient order for the index.
        tevilis-iter_all_entries scales with size of history.N(	R	RRtmutter_callsiteRRRRR-(R
RR2R((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR's		

	"cC@s|jt|j}||jksEtj|jtn|j}|jt	srtj
|ny t|tt	d!|_Wn t
k
rtj
|nX|j}|jtstj
|ny t|ttd!|_Wn t
k
r$tj
|nX|j}|jtsRtj
|ny t|ttd!|_Wn t
k
rtj
|nXdS(Ni(RR"t
_signatureR
tBadIndexFormatSignatureR}Rtreadlinet
startswithRNtBadIndexOptionstintRRRPRRQR(R
Rt	signaturetoptions_line((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR*s0 
 
 
cC@sRg}x?|D]7}|jtg|D]}|j|d^q#q
Wt|S(sqReturn the resolved key references for references.

        References are resolved by looking up the location of the key in the
        _keys_by_offset map and substituting the key name, preserving ordering.

        :param references: An iterable of iterables of key locations. e.g.
            [[123, 456], [123]]
        :return: A tuple of tuples of keys.
        i(R<R R(R
R1R6R`RB((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRDs

5cC@sTt||d}|dt|krP||dd|dkrP|dSn|S(sHelper for the _parsed_*_index calls.

        Given a range map - [(start, end), ...], finds the index of the range
        in the map for key if it is in the map, and if it is not there, the
        immediately preceeding range in the map.
        ii(RR"(R
t	range_mapRRh((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt_find_indexSs
cC@s|df}|j|j|S(sgReturn the index of the entry immediately before offset.

        e.g. if the parsed map has regions 0,10 and 11,12 parsed, meaning that
        there is one unparsed byte (the 11th, addressed as[10]). then:
        asking for 0 will return 0
        asking for 10 will return 0
        asking for 11 will return 1
        asking for 12 will return 1
        i(RR(R
RR((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt_parsed_byte_indexas
cC@s|df}|j|j|S(sReturn the index of the entry immediately before key.

        e.g. if the parsed map has regions (None, 'a') and ('b','c') parsed,
        meaning that keys from None to 'a' inclusive, and 'b' to 'c' inclusive
        have been parsed, then:
        asking for '' will return 0
        asking for 'a' will return 0
        asking for 'b' will return 1
        asking for 'e' will return 1
        N(RRR(R
Rt
search_key((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt_parsed_key_indexnscC@sf|j|}|t|jkr=||j|ddkS|j|\}}||koe||kS(s'Returns True if offset has been parsed.i(RR"R(R
RRtstarttend((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt
_is_parsed|s
cc@s|j}g|D]}||kr|^q}|jrlxU|D]'}||\}}||||fVq>Wn#x |D]}||||fVqsWdS(s2Iterate over keys when the entire index is parsed.N(RR(R
RR[RR2R6((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt_iter_entries_from_total_buffers	%	

cC@st|}|sgS|jdkrA|jdkrA|jn|jdkryt|d|jkry|jn|jdk	r|j|Sdtj	|j
|j|DSdS(sHIterate over keys within the index.

        :param keys: An iterable providing the keys to be retrieved.
        :return: An iterable as per iter_all_entries, but restricted to the
            keys supplied. No additional keys will be returned, and every
            key supplied that is in the index will be returned.
        ics@s|]}|dVqdS(iN((RJRh((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pys	<genexpr>sN(RRRRRR"RYRtbisect_multitbisect_multi_bytest_lookup_keys_via_location(R
R((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRms
	+

c
c@s\t|}|sdS|jdkr2|jn|jdkrx|D]}|ddkrptj|nt||jkrtj|n|jr|j|\}}||||fVqH|||j|fVqHWdS|j	}xe|D]]}|ddkrtj|nt||jkrFtj|n|}t
|}yBx;t|r|ddk	r||d}|jdq^WWntk
rqnXt|rH|g}x|rD|jd}|j
j\}	}t|tkr|j|jqx |jD]}|f|Vq+WqWq|f|VqWdS(sIterate over keys within the index using prefix matching.

        Prefix matching is applied within the tuple of a key, not to within
        the bytestring of each key element. e.g. if you have the keys ('foo',
        'bar'), ('foobar', 'gam') and do a prefix search for ('foo', None) then
        only the former key is returned.

        WARNING: Note that this method currently causes a full index parse
        unconditionally (which is reasonably appropriate as it is a means for
        thunking many small indices into one larger one and still supplies
        iter_all_entries at the thunk layer).

        :param keys: An iterable providing the key prefixes to be retrieved.
            Each key prefix takes the form of a tuple the length of a key, but
            with the last N elements 'None' rather than a regular bytestring.
            The first element cannot be 'None'.
        :return: An iterable as per iter_all_entries, but restricted to the
            keys with a matching prefix to those supplied. No additional keys
            will be returned, and every match that is in the index will be
            returned.
        Niii(RRRRRR
R!R"RR5tlisttpoptKeyErrorR-tnextRtdicttextendR(
R
RRR2R6R/R3telementstdictstitem((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pytiter_entries_prefixsP

	

		cC@st}t}xQ|j|D]@\}}}	}
|
|}|j||||<|j|q"W|jt|j||j|}|S(sSee BTreeIndex._find_ancestors.(RRmR(R)Rn(R
RRoRqRrt
found_keystsearch_keysRRR2R*Rv((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt_find_ancestorss		"


cC@s)|jdkr"|jtgn|jS(soReturn an estimate of the number of keys in this index.

        For GraphIndex the estimate is exact.
        N(RRt_read_and_parset
_HEADER_READV(R
((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRYscC@sNg}x;|D]3\}}|jr7||jkr7q
n|j|}t|jr|j|d|kr|j|d|ks
|j|d|jkrq
n|j|}t|jr|j|d|kr|j|d|krq
nd}|||jkr|j|}n|dkr
|j||fq
q
W|jdkrc|jt	n|j
|g}|jdk	r8x|D]\}}||jkr|j||ftfq|j
r|j|\}}	|j||f||||	ffq|j||f|||j|ffqW|Sg}
t}x|D]\}}||jkrX|j
r)|j|\}}	g}x>|	D]6}
x-|
D]%}||jkr|j|qqWqW|r|j||
j||fqNn|j||f||||j|	ffqN|j||f|||j|ffqNnv|j|}|j|d|kr|j|d|ks|j|d|jkr|j||ftfqNn|j|}||j|dkrd}nd
}|j||f|fqNWg}xY|D]Q}d}|||jkr]|j|}n|dkr.|j||fq.q.W|j
||jdk	rxL|
D]D\}}|j|\}}	|j||f||||	ffqW|SxU|
D]M\}}|j|\}}	|j||f||||j|	ffqW|S(sPublic interface for implementing bisection.

        If _buffer_all has been called, then all the data for the index is in
        memory, and this method should not be called, as it uses a separate
        cache because it cannot pre-resolve all indices, which buffer_all does
        for performance.

        :param location_keys: A list of location(byte offset), key tuples.
        :return: A list of (location_key, result) tuples as expected by
            bzrlib.bisect_multi.bisect_multi_bytes.
        iii iN(R~RR"RRRRR<RRRRRRRRR)R(R
t
location_keystreadv_rangestlocationRRtlengthRhR2R*tpending_referencestpending_locationstwanted_locationsR`RBt	direction((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRs
			


	

)cC@s |dt|j!}||jksCtj|jtn|t|jj}|d}|jtstj	|nyt
|tt|_Wn tk
rtj	|nX|d}|jt
stj	|nyt
|tt
|_Wn tk
r4tj	|nX|d}|jts`tj	|nyt
|tt|_Wn tk
rtj	|nXt|t|dt|dt|dd}|jdd|dd|j|_i|_i|_|||fS(sParse the header from a region of bytes.

        :param bytes: The data to parse.
        :return: An offset, data tuple such as readv yields, for the unparsed
            data. (which may length 0).
        iiiiN(R"RR
RR}Rt
splitlinesRRNRRRRRPRRQRt
_parsed_bytesRRRR~(R
tbytesRRXRt
header_end((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt_parse_header_from_bytess>





:		cC@sy|t|}|}x\trt|j|}||j|dkrIdS|j||||\}}|rdSqWdS(sParse node data returned from a readv operation.

        :param offset: The byte offset the data starts at.
        :param data: The data to parse.
        iN(R"RRRt_parse_segment(R
RtdataRthigh_parsedRtlast_segment((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt
_parse_regions	cC@sd}||j|dkr;|j|d|}t}n2||j|dkrad}t}nd}t}||jkrd}t}t}	n|dt|jkrd}t}t}	n||j|ddkrd}t}t}	nj||j|ddkrG|j|dd|}t}||j|ddk}	nd}t}t}	|s|dkr|jdd}n|jd|d}|dkstdqn|s|dkr|jdd}n|jdd|d}|dkstdqn|||!}
|
sPtd||||t|fn|rc||7}n|
j	d}|d=|}|j
||\}
}}}x!|D]\}}||j|<qW|j||
|t|
||t|
|	fS(sYParse one segment of data.

        :param offset: Where 'data' begins in the file.
        :param data: Some data to parse a segment of.
        :param end: Where data ends
        :param index: The current index into the parsed bytes map.
        :return: True if the parsed segment is the last possible one in the
            range of data.
        :return: high_parsed_byte, last_segment.
            high_parsed_byte is the location of the highest parsed byte in this
            segment, last_segment is True if the parsed segment is the last
            possible one in the data block.
        iis
sno 
 was presents'read unneeded data [%d:%d] from [%d:%d]iN(
RRRRRR"tfindtAssertionErrortrfindRRR~R(R
RRRRttrim_endt
trim_starttstart_adjacenttend_adjacentRttrimmed_dataRXRt	first_keytlast_keyR[RtRR2((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRsn					
#
cC@sd}d}d}g}x|D]}|dkr||jrl|j|dksltd|j|fqln|d7}qn|jd}t||jkrtj|ntg||j	 D]}	t
|	^q}|dkr|}n|d\}
}}g}
xR|jdD]A}|
jtg|jdD]}|r;t|^q;qWt|
}
||
|
|f|j
|<|t|d7}|
rqn|jr||
f}n|}|j||fqW||||fS(	NiREis%s %sRLis	s
(RRRRR"RR
RR RR=R<RRR(R
RXRRRRR[tlineRR%R0R1R2Rut
ref_stringRBR((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRTs@
	
,		6	cC@s,|j|}||f}||f}|dkr]|jj|||jj||dS|dt|jkr!|j|d|kr!|j|dd|kr!|j|d|j|ddf|j|<|j|d|j|ddf|j|<|j|d=|j|d=n|j|d|krw|j|d|f|j|<|j|d|f|j|<n|dt|jkr|j|dd|kr||j|ddf|j|d<||j|ddf|j|d<n.|jj|d||jj|d|dS(sMark the bytes from start to end as parsed.

        Calling self._parsed_bytes(1,2) will mark one byte (the one at offset
        1) as parsed.

        :param start: The start of the parsed region.
        :param end: The end of the parsed region.
        iNii(RRtinsertRR"(R
Rt	start_keyRtend_keyRt	new_valuetnew_key((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR|s2	!&)cC@s|s
dS|jdkr=|jd|jkr=|jdS|j}|dkr~g|D]\}}|||f^qY}n|jj|j|t	|j|j}x|D]\}}||8}|jt
|7_|dkr||}d}n|dkr0t
||jkr0|jt|dS|jdkro|dksWt
n|j|\}}n|j||qWdS(sqRead the ranges and parse the resulting data.

        :param readv_ranges: A prepared readv range list.
        Nii(RRRRRRR|treadvR}RR"RR~RRR(R
Rtbase_offsetRRt
readv_dataRR((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRs2%
	)
	!cC@stS(s'The file signature for this index type.(RM(R
((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRscC@sx|jD]}q
WdS(s6Validate that everything in the index can be accessed.N(R'(R
R+((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pytvalidatesN("RyRzR{RRRRRRRRIRR5R'RRRRRRRRmRRRYRRRRRRRRR(((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRxs<&			.								
					N					,		l	(	2	+	cB@seZdZddZdZdZdZeZ	ddZ
dZdZdZ
d	Zd
ZdZdZd
ZeZdZdZdZRS(sA GraphIndex made up from smaller GraphIndices.

    The backing indices must implement GraphIndex, and are presumed to be
    static data.

    Queries against the combined index will be made against the first index,
    and then the second and so on. The order of indices can thus influence
    performance significantly. For example, if one index is on local disk and a
    second on a remote server, the local disk index should be before the other
    in the index list.
    
    Also, queries tend to need results from the same indices as previous
    queries.  So the indices will be reordered after every query to put the
    indices that had the result(s) of that query first (while otherwise
    preserving the relative ordering).
    cC@s8||_||_g|_dgt|j|_dS(sNCreate a CombinedGraphIndex backed by indices.

        :param indices: An ordered list of indices to query for data.
        :param reload_func: A function to call if we find we are missing an
            index. Should have the form reload_func() => True/False to indicate
            if reloading actually changed anything.
        N(t_indicest_reload_funct_sibling_indicesRR"t_index_names(R
tindicestreload_func((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRs			cC@s)d|jjdjtt|jfS(Ns%s(%s)s, (RRyRUtmaptreprR(R
((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRs	cC@s"x|jD]}|jq
WdS(sSee GraphIndex.clear_cache()N(RRI(R
R((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRI
sc	C@st|}tj|kr>|jtjigtj6}ni}xL|j|D];\}}}}|d}|stjf}n|||<qTW|S(s/See graph.StackedParentsProvider.get_parent_mapi(Rt
_mod_revisiont
NULL_REVISIONRGRm(	R
RRt
found_parentsRRR2R*tparents((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRs"
cC@s*|jj|||jj||dS(sInsert a new index in the list of indices to query.

        :param pos: The position to insert the index.
        :param index: The index to insert.
        :param name: a name for this index, e.g. a pack name.  These names can
            be used to reflect index reorderings to related CombinedGraphIndex
            instances that use the same names.  (see set_sibling_indices)
        N(RRR(R
RRR((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pytinsert_index#s	cc@st}xtry\xQ|jD]F}x=|jD]/}|d|kr2|V|j|dq2q2WqWdSWqtjk
r|jqXqWdS(snIterate over all keys within the index

        Duplicate keys across child indices are presumed to have the same
        value and are only reported once.

        :return: An iterable of (index, key, reference_lists, value).
            There is no defined order for the result iteration - it will be in
            the most efficient order for the index.
        iN(RRRR'R(R
t
NoSuchFilet_reload_or_raise(R
t	seen_keysRR+((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR'/s
		cc@st|}g}xtryuxm|jD]b}|s8Pnt}x3|j|D]"}|j|d|Vt}qNW|r(|j|q(q(WPWqtjk
r|j	qXqW|j
|dS(sIterate over keys within the index.

        Duplicate keys across child indices are presumed to have the same
        value and are only reported once.

        :param keys: An iterable providing the keys to be retrieved.
        :return: An iterable of (index, key, reference_lists, value). There is
            no defined order for the result iteration - it will be in the most
            efficient order for the index.
        iN(RRRRRmtremoveR<R
RRt_move_to_front(R
Rthit_indicesRt	index_hitR+((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRmEs$	
cc@st|}|sdSt}g}xtryxy|jD]n}t}xI|j|D]8}|d|krsqWn|j|d|Vt}qWW|r;|j|q;q;WPWq(tjk
r|j	q(Xq(W|j
|dS(sIterate over keys within the index using prefix matching.

        Duplicate keys across child indices are presumed to have the same
        value and are only reported once.

        Prefix matching is applied within the tuple of a key, not to within
        the bytestring of each key element. e.g. if you have the keys ('foo',
        'bar'), ('foobar', 'gam') and do a prefix search for ('foo', None) then
        only the former key is returned.

        :param keys: An iterable providing the key prefixes to be retrieved.
            Each key prefix takes the form of a tuple the length of a key, but
            with the last N elements 'None' rather than a regular bytestring.
            The first element cannot be 'None'.
        :return: An iterable as per iter_all_entries, but restricted to the
            keys with a matching prefix to those supplied. No additional keys
            will be returned, and every match that is in the index will be
            returned.
        Ni(RRRRRR(R<R
RRR(R
RRRRRR+((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRcs*		
cC@sQ|jt| |krdS|j|}x|jD]}|j|q6WdS(sRearrange self._indices so that hit_indices are first.

        Order is maintained as much as possible, e.g. the first unhit index
        will be the first index in _indices after the hit_indices, and the
        hit_indices will be present in exactly the order they are passed to
        _move_to_front.

        _move_to_front propagates to all objects in self._sibling_indices by
        calling _move_to_front_by_name.
        N(RR"t_move_to_front_by_indexRt_move_to_front_by_name(R
Rt	hit_namestsibling_idx((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRs
c
C@sGt|j|j}dtjkr:tjd||ng}g}g}g}xt|D]\}\}}	|	|kr|j||j|	t	|t	|kr|j
|j|d|j
|j|dPqq_|j||j|	q_W|||_|||_dtjkrCtjd|jn|S(sxCore logic for _move_to_front.
        
        Returns a list of names corresponding to the hit_indices param.
        Rs9CombinedGraphIndex reordering: currently %r, promoting %ris CombinedGraphIndex reordered: %r(tzipRRR	RRRt	enumerateR<R"R(
R
Rtindices_infoRtunhit_namestnew_hit_indicest
unhit_indicesRRtidx((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR	s.	





cC@s_t|j|j}g}x0|D](\}}||kr"|j|q"q"W|j|dS(sqMoves indices named by 'hit_names' to front of the search order, as
        described in _move_to_front.
        N(R
RRR<R	(R
RRRRR((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR
sc
C@s t}i}t|}d}x|r|d7}d}xt|jD]\}}	t}
|}d}x,|r|d7}|	j||||
}qnW|
}|dkrt|
}n
|j|
|sJPqJqJW|dkr|j|d}q$|j||j|q$W||fS(seFind the complete ancestry for the given set of keys.

        Note that this is a whole-ancestry request, so it should be used
        sparingly.

        :param keys: An iterable of keys to look for
        :param ref_list_num: The reference list which references the parents
            we care about.
        :return: (parent_map, missing_keys)
        iiN(RRRRRtintersection_updateR)tdifference_update(
R
RRoRrRqtkeys_to_lookupt
generationtall_index_missingt	index_idxRtindex_missing_keysRtsub_generation((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRxs6		
		
	

	
cC@sPxItrKytd|jDdSWqtjk
rG|jqXqWdS(sGReturn an estimate of the number of keys in this index.

        For CombinedGraphIndex this is approximated by the sum of the keys of
        the child indices. As child indices may have duplicate keys this can
        have a maximum error of the number of child indices * largest number of
        keys in any index.
        cs@s|]}|jVqdS(N(RY(RJR((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pys	<genexpr>siN(RRRRR
RR(R
((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRYs
	cC@sf|jdkrntj\}}}tjd||jsbtjd|||ndS(sWe just got a NoSuchFile exception.

        Try to reload the indices, if it fails, just raise the current
        exception.
        s,Trying to reload after getting exception: %ssG_reload_func indicated nothing has changed. Raising original exception.N(RRtsystexc_infoRR(R
texc_typet	exc_valuet
exc_traceback((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRs	
cC@s
||_dS(sMSet the CombinedGraphIndex objects to reorder after reordering self.
        N(R(R
tsibling_combined_graph_indices((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pytset_sibling_indices0scC@sXxQtrSy&x|jD]}|jqWdSWqtjk
rO|jqXqWdS(s6Validate that everything in the index can be accessed.N(RRRR
RR(R
R((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR5s	N(RyRzR{RRRRIRRthas_keyRR'RmRRR	R
RxRYRRrRR"R(((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRs&						*		"	
	@			cB@sDeZdZdZdZdZdZdZdZRS(sA GraphIndex which operates entirely out of memory and is mutable.

    This is designed to allow the accumulation of GraphIndex entries during a
    single write operation, where the accumulated entries need to be immediately
    available - for example via a CombinedGraphIndex.
    cC@sd|jr9xT|D]"\}}}|j|||qWn'x$|D]\}}|j||q@WdS(snAdd nodes to the index.

        :param nodes: An iterable of (key, node_refs, value) entries to add.
        N(RRH(R
R[RR2R6((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt	add_nodesHs
	cc@sdtjkr"tjddn|jrqx|jjD]/\}\}}}|s;||||fVq;q;Wn@x=|jjD],\}\}}}|s|||fVqqWdS(sIterate over all keys within the index

        :return: An iterable of (index, key, reference_lists, value). There is no
            defined order for the result iteration - it will be in the most
            efficient order for the index (in this case dictionary hash order).
        Ris-iter_all_entries scales with size of history.N(R	RRRRRR-(R
RR0R1R2((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR'Ts	
	%%cc@s|j}g|D]}||kr|^q}|jr{x{|D]6}||}|ds>|||d|dfVq>q>Wn:x7|D]/}||}|ds|||dfVqqWdS(s_Iterate over keys within the index.

        :param keys: An iterable providing the keys to be retrieved.
        :return: An iterable of (index, key, value, reference_lists). There is no
            defined order for the result iteration - it will be in the most
            efficient order for the index (keys iteration order in this case).
        iiiN(RR(R
RR[RR+((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRmgs
	%	


#


c
c@sOt|}|sdS|jdkrx|D]}|ddkrTtj|nt||jkr{tj|n|j|}|drq,n|jr|||d|dfVq,|||dfVq,WdS|j}xe|D]]}|ddkrtj|nt||jkr9tj|n|}t	|}yBx;t|r|ddk	r||d}|j
dqQWWntk
rqnXt|r;|g}x|r7|j
d}|jj
\}}	t|	tkr|j|jqx |jD]}	|f|	VqWqWq|f|VqWdS(slIterate over keys within the index using prefix matching.

        Prefix matching is applied within the tuple of a key, not to within
        the bytestring of each key element. e.g. if you have the keys ('foo',
        'bar'), ('foobar', 'gam') and do a prefix search for ('foo', None) then
        only the former key is returned.

        :param keys: An iterable providing the key prefixes to be retrieved.
            Each key prefix takes the form of a tuple the length of a key, but
            with the last N elements 'None' rather than a regular bytestring.
            The first element cannot be 'None'.
        :return: An iterable as per iter_all_entries, but restricted to the
            keys with a matching prefix to those supplied. No additional keys
            will be returned, and every match that is in the index will be
            returned.
        Niiii(RRRR
R!R"RRR5RRRR-RRRRR(
R
RRR+R/R3RRRR2((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR~sP


	

		cC@st|jt|jS(swReturn an estimate of the number of keys in this index.

        For InMemoryGraphIndex the estimate is exact.
        (R"RR(R
((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRYscC@sdS(s9In memory index's have no known corruption at the moment.N((R
((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRs(	RyRzR{R$R'RmRRYR(((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR@s				G	cB@seeZdZd
dZdZddZdZdZdZ	dZ
dZd	ZRS(sAn adapter between GraphIndex with different key lengths.

    Queries against this will emit queries against the adapted Graph with the
    prefix added, queries for all items use iter_entries_prefix. The returned
    nodes will have their keys and node references adjusted to remove the
    prefix. Finally, an add_nodes_callback can be supplied - when called the
    nodes and references being added will have prefix prepended.
    cC@s?||_|d||_||_t||_||_dS(s1Construct an adapter against adapted with prefix.N(N(tadaptedRt
prefix_keytprefixR"t
prefix_lentadd_nodes_callback(R
R%R'tmissing_key_lengthR)((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRs
		c@st|}g}yWxP|D]H\}}}tfd|D}|jj|||fqWWnBtk
rx2|D]&\}}|jj||fqWnXj|dS(snAdd nodes to the index.

        :param nodes: An iterable of (key, node_refs, value) entries to add.
        c3@s+|]!}tfd|DVqdS(c3@s|]}j|VqdS(N(R'(RJtref_node(R
(s0/usr/lib/python2.7/dist-packages/bzrlib/index.pys	<genexpr>sN(R (RJR`(R
(s0/usr/lib/python2.7/dist-packages/bzrlib/index.pys	<genexpr>sN(R R<R'RR)(R
R[ttranslated_nodesRR2R6tadjusted_references((R
s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR$s

"cC@s|j|||ffdS(sAdd a node to the index.

        :param key: The key. keys are non-empty tuples containing
            as many whitespace-free utf8 bytestrings as the key length
            defined for this index.
        :param references: An iterable of iterables of keys. Each is a
            reference to another key.
        :param value: The value to associate with the key. It may be any
            bytes as long as it does not contain  or 
.
        N(R$(R
RR2R1((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRHsc#@sx|D]}|dj jkr9tjnxK|dD]?}x6|D].}|j jkrQtjqQqQWqDW|d|dj|dtfd|dDfVqWdS(s+Strip prefix data from nodes and return it.iiiic3@s+|]!}tfd|DVqdS(c3@s|]}|jVqdS(N(R((RJR+(R
(s0/usr/lib/python2.7/dist-packages/bzrlib/index.pys	<genexpr>sN(R (RJR`(R
(s0/usr/lib/python2.7/dist-packages/bzrlib/index.pys	<genexpr>sN(R(R'R
RR (R
tan_iterR+R`R+((R
s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt
_strip_prefix	s

cC@s|j|jj|jgS(sIterate over all keys within the index

        iter_all_entries is implemented against the adapted index using
        iter_entries_prefix.

        :return: An iterable of (index, key, reference_lists, value). There is no
            defined order for the result iteration - it will be in the most
            efficient order for the index (in this case dictionary hash order).
        (R/R%RR&(R
((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR's
c@s)jjjfd|DS(s_Iterate over keys within the index.

        :param keys: An iterable providing the keys to be retrieved.
        :return: An iterable of (index, key, value, reference_lists). There is no
            defined order for the result iteration - it will be in the most
            efficient order for the index (keys iteration order in this case).
        c3@s|]}j|VqdS(N(R'(RJR(R
(s0/usr/lib/python2.7/dist-packages/bzrlib/index.pys	<genexpr>,s(R/R%Rm(R
R((R
s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRm#sc@s)jjjfd|DS(slIterate over keys within the index using prefix matching.

        Prefix matching is applied within the tuple of a key, not to within
        the bytestring of each key element. e.g. if you have the keys ('foo',
        'bar'), ('foobar', 'gam') and do a prefix search for ('foo', None) then
        only the former key is returned.

        :param keys: An iterable providing the key prefixes to be retrieved.
            Each key prefix takes the form of a tuple the length of a key, but
            with the last N elements 'None' rather than a regular bytestring.
            The first element cannot be 'None'.
        :return: An iterable as per iter_all_entries, but restricted to the
            keys with a matching prefix to those supplied. No additional keys
            will be returned, and every match that is in the index will be
            returned.
        c3@s|]}j|VqdS(N(R'(RJR(R
(s0/usr/lib/python2.7/dist-packages/bzrlib/index.pys	<genexpr>@s(R/R%R(R
R((R
s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyR.scC@stt|jS(sReturn an estimate of the number of keys in this index.

        For GraphIndexPrefixAdapter this is relatively expensive - key
        iteration with the prefix is done.
        (R"RR'(R
((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRYBscC@s|jjdS(sCall the adapted's validate.N(R%R(R
((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRJsN((
RyRzR{RRR$RHR/R'RmRRYR(((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyRs	
					("R{t
__future__Rt__all__tbisectRt	cStringIORtreRtbzrlib.lazy_importRtglobalstbzrlibR	R
tbzrlib.static_tupleRRRPRQRNRMtcompileR#R:RRtobjectRRRRR(((s0/usr/lib/python2.7/dist-packages/bzrlib/index.pyt<module>sD					1o]

Copyright © 2017 || Recoded By Mr.Bumblebee