2681
2681
:param key: The key to annotate.
2683
if True or len(self._knit._fallback_vfs) > 0:
2684
# stacked knits can't use the fast path at present.
2685
return self._simple_annotate(key)
2683
2686
records = self._get_build_graph(key)
2684
2687
if key in self._ghosts:
2685
2688
raise errors.RevisionNotPresent(key, self._knit)
2686
2689
self._annotate_records(records)
2687
2690
return self._annotated_lines[key]
2692
def _simple_annotate(self, key):
2693
"""Return annotated fulltext, rediffing from the full texts.
2695
This is slow but makes no assumptions about the repository
2696
being able to produce line deltas.
2698
# TODO: this code generates a parent maps of present ancestors; it
2699
# could be split out into a separate method, and probably should use
2700
# iter_ancestry instead. -- mbp and robertc 20080704
2701
graph = Graph(self._knit)
2702
head_cache = _mod_graph.FrozenHeadsCache(graph)
2703
search = graph._make_breadth_first_searcher([key])
2707
present, ghosts = search.next_with_ghosts()
2708
except StopIteration:
2710
keys.update(present)
2711
parent_map = self._knit.get_parent_map(keys)
2713
reannotate = annotate.reannotate
2714
for record in self._knit.get_record_stream(keys, 'topological', True):
2716
fulltext = split_lines(record.get_bytes_as('fulltext'))
2717
parent_lines = [parent_cache[parent] for parent in parent_map[key]]
2718
parent_cache[key] = list(
2719
reannotate(parent_lines, fulltext, key, None, head_cache))
2720
return parent_cache[key]
2691
2724
from bzrlib._knit_load_data_c import _load_data_c as _load_data