~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/groupcompress.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-02 21:43:05 UTC
  • mto: This revision was merged to the branch mainline in revision 4522.
  • Revision ID: john@arbash-meinel.com-20090702214305-sss4k9xd5shtu99z
Enable the new annotator for gc format repos.

Determine that I was accidentally calling _get_needed_keys 2 times,
which was causing the code to double the reference counts, and thus
never free the desired items.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1069
1069
 
1070
1070
    def annotate(self, key):
1071
1071
        """See VersionedFiles.annotate."""
1072
 
        graph = Graph(self)
1073
 
        parent_map = self.get_parent_map([key])
1074
 
        if not parent_map:
1075
 
            raise errors.RevisionNotPresent(key, self)
1076
 
        if parent_map[key] is not None:
1077
 
            parent_map = dict((k, v) for k, v in graph.iter_ancestry([key])
1078
 
                              if v is not None)
1079
 
            keys = parent_map.keys()
1080
 
        else:
1081
 
            keys = [key]
1082
 
            parent_map = {key:()}
1083
 
        # We used Graph(self) to load the parent_map, but now that we have it,
1084
 
        # we can just query the parent map directly, so create a KnownGraph
1085
 
        heads_provider = _mod_graph.KnownGraph(parent_map)
1086
 
        parent_cache = {}
1087
 
        reannotate = annotate.reannotate
1088
 
        for record in self.get_record_stream(keys, 'topological', True):
1089
 
            key = record.key
1090
 
            lines = osutils.chunks_to_lines(record.get_bytes_as('chunked'))
1091
 
            parent_lines = [parent_cache[parent] for parent in parent_map[key]]
1092
 
            parent_cache[key] = list(
1093
 
                reannotate(parent_lines, lines, key, None, heads_provider))
1094
 
        return parent_cache[key]
 
1072
        ann = annotate.Annotator(self)
 
1073
        return ann.annotate_flat(key)
1095
1074
 
1096
1075
    def check(self, progress_bar=None):
1097
1076
        """See VersionedFiles.check()."""