b._.Annotator(object) : class documentation

Part of bzrlib._annotator_py View In Hierarchy

Class that drives performing annotations.
Method __init__ Create a new Annotator from a VersionedFile.
Method add_special_text Add a specific text to the graph.
Method annotate Return annotated fulltext for the given key.
Method annotate_flat Determine the single-best-revision to source for each line.
Method _update_needed_children Undocumented
Method _get_needed_keys Determine the texts we need to get from the backing vf.
Method _get_needed_texts Get the texts we need to properly annotate key.
Method _get_parent_annotations_and_matches Get the list of annotations for the parent, and the matching lines.
Method _update_from_first_parent Reannotate this text relative to its first parent.
Method _update_from_other_parents Reannotate this text relative to a second (or more) parent.
Method _record_annotation Undocumented
Method _annotate_one Undocumented
Method _get_heads_provider Undocumented
Method _resolve_annotation_tie Undocumented
def __init__(self, vf):
Create a new Annotator from a VersionedFile.
def _update_needed_children(self, key, parent_keys):
Undocumented
def _get_needed_keys(self, key):
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.
def _get_needed_texts(self, key, pb=None):
Get the texts we need to properly annotate key.
ParameterskeyA Key that is present in self._vf
ReturnsYield (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.
def _get_parent_annotations_and_matches(self, key, text, parent_key):
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
def _update_from_first_parent(self, key, annotations, lines, parent_key):
Reannotate this text relative to its first parent.
def _update_from_other_parents(self, key, annotations, lines, this_annotation, parent_key):
Reannotate this text relative to a second (or more) parent.
def _record_annotation(self, key, parent_keys, annotations):
Undocumented
def _annotate_one(self, key, text, num_lines):
Undocumented
def add_special_text(self, key, parent_keys, text):
Add a specific text to the graph.

This is used to add a text which is not otherwise present in the versioned file. (eg. a WorkingTree injecting 'current:' into the graph to annotate the edited content.)

ParameterskeyThe key to use to request this text be annotated
parent_keysThe parents of this text
textA string containing the content of the text
def annotate(self, key):
Return annotated fulltext for the given key.

:param key: A tuple defining the text to annotate
:return: ([annotations], [lines])
    annotations is a list of tuples of keys, one for each line in lines
                each key is a possible source for the given line.
    lines the text of "key" as a list of lines
def _get_heads_provider(self):
Undocumented
def _resolve_annotation_tie(self, the_heads, line, tiebreaker):
Undocumented
def annotate_flat(self, key):
Determine the single-best-revision to source for each line.

This is meant as a compatibility thunk to how annotate() used to work.
:return: [(ann_key, line)]
    A list of tuples with a single annotation key for each line.
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.