-=[ Mr. Bumblebee ]=-
_Indonesia_
:Nc @@ sl d Z d d l m Z d d l m Z e e d d d l m Z m Z m Z d e
f d YZ d S( s8 Functionality for doing annotations in the 'optimal' wayi ( t absolute_import( t lazy_imports
from bzrlib import (
annotate, # Must be lazy to avoid circular importing
graph as _mod_graph,
patiencediff,
)
( t errorst osutilst uit Annotatorc B@ s e Z d Z d Z d Z d Z d d Z d Z d Z d Z
d Z d Z d
Z
d Z d Z d
Z d Z RS( s) Class that drives performing annotations.c C@ sC | | _ i | _ i | _ i | _ i | _ d | _ i | _ d S( s, Create a new Annotator from a VersionedFile.N( t _vft _parent_mapt _text_cachet _num_needed_childrent _annotations_cachet Nonet _heads_providert _ann_tuple_cache( t selft vf( ( s8 /usr/lib/python2.7/dist-packages/bzrlib/_annotator_py.pyt __init__' s c C@ sG x@ | D]8 } | | j k r2 | j | c d 7<q d | j | <q Wd S( Ni ( R ( R t keyt parent_keyst
parent_key( ( s8 /usr/lib/python2.7/dist-packages/bzrlib/_annotator_py.pyt _update_needed_children2 s
c C@ s | j } d | j | <t } t } t | g } xR| rg } i } x | D] } | | j k r | | j k r | j | q | | j k r | j | | j | | | <q qS | j | | j | qS Wt } | j | j j | xu | j
D]g \ } } | d k r2d } d | | <n | j | | | j g | D] } | | k rO| ^ qO qW| j | d | _
q: W| | f S( s Determine the texts we need to get from the backing vf.
:return: (vf_keys_needed, ann_keys_needed)
vf_keys_needed These are keys that we need to get from the vf
ann_keys_needed Texts which we have in self._text_cache but we
don't have annotations for. We need to yield these
in the proper order so that we can get proper
annotations.
i N( ( ( R R t setR t addR
t appendt updateR t get_parent_mapt iteritemsR R R ( R R t
parent_mapt vf_keys_neededt ann_keys_neededt needed_keyst
parent_lookupt next_parent_mapR ( ( s8 /usr/lib/python2.7/dist-packages/bzrlib/_annotator_py.pyt _get_needed_keys9 s:
c c@ sH | j | \ } } | d k r= | j d d t | n | j j | d t } x t | D] \ } } | d k r | j d d t | n | j d k r t j
| j | j n | j } t j
| j d } t | }
| | j | <| | |
f Vqb Wx5 | D]- } | j | } t | }
| | |
f VqWd S( s Get the texts we need to properly annotate key.
:param key: A Key that is present in self._vf
:return: Yield (this_key, text, num_lines)
'text' is an opaque object that just has to work with whatever
matcher object we are using. Currently it is always 'lines' but
future improvements may change this to a simple text string.
s getting streami t topologicalt
extractingt absentt chunkedN( R! R R t lenR t get_record_streamt Truet enumeratet storage_kindR t RevisionNotPresentR R t chunks_to_linest get_bytes_asR ( R R t pbt keyst ann_keyst streamt idxt recordt this_keyt linest num_lines( ( s8 /usr/lib/python2.7/dist-packages/bzrlib/_annotator_py.pyt _get_needed_textsi s$
c C@ sE | j | } | j | } t j d | | } | j } | | f S( s Get the list of annotations for the parent, and the matching lines.
:param text: The opaque value given by _get_needed_texts
:param parent_key: The key for the parent text
:return: (parent_annotations, matching_blocks)
parent_annotations is a list as long as the number of lines in
parent
matching_blocks is a list of (parent_idx, text_idx, len) tuples
indicating which lines match between the two texts
N( R R
t patiencedifft PatienceSequenceMatcherR t get_matching_blocks( R R t textR t parent_linest parent_annotationst matchert matching_blocks( ( s8 /usr/lib/python2.7/dist-packages/bzrlib/_annotator_py.pyt# _get_parent_annotations_and_matches s
c
C@ sU | j | | | \ } } x3 | D]+ \ } } } | | | | !| | | | +q"