/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/groupcompress.py

  • Committer: Vincent Ladeuil
  • Date: 2009-07-15 07:32:26 UTC
  • mfrom: (4536 +trunk)
  • mto: (4536.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4537.
  • Revision ID: v.ladeuil+lp@free.fr-20090715073226-a7ylxd6ctbzeu0o6
Merge trunk resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Core compression logic for compressing streams of related files."""
18
18
 
19
 
from itertools import izip
20
 
from cStringIO import StringIO
21
19
import time
22
20
import zlib
23
21
try:
28
26
from bzrlib import (
29
27
    annotate,
30
28
    debug,
31
 
    diff,
32
29
    errors,
33
30
    graph as _mod_graph,
34
31
    knit,
35
32
    osutils,
36
33
    pack,
37
 
    patiencediff,
38
34
    trace,
39
35
    )
40
36
from bzrlib.graph import Graph
1073
1069
 
1074
1070
    def annotate(self, key):
1075
1071
        """See VersionedFiles.annotate."""
1076
 
        graph = Graph(self)
1077
 
        parent_map = self.get_parent_map([key])
1078
 
        if not parent_map:
1079
 
            raise errors.RevisionNotPresent(key, self)
1080
 
        if parent_map[key] is not None:
1081
 
            parent_map = dict((k, v) for k, v in graph.iter_ancestry([key])
1082
 
                              if v is not None)
1083
 
            keys = parent_map.keys()
1084
 
        else:
1085
 
            keys = [key]
1086
 
            parent_map = {key:()}
1087
 
        # We used Graph(self) to load the parent_map, but now that we have it,
1088
 
        # we can just query the parent map directly, so create a KnownGraph
1089
 
        heads_provider = _mod_graph.KnownGraph(parent_map)
1090
 
        parent_cache = {}
1091
 
        reannotate = annotate.reannotate
1092
 
        for record in self.get_record_stream(keys, 'topological', True):
1093
 
            key = record.key
1094
 
            lines = osutils.chunks_to_lines(record.get_bytes_as('chunked'))
1095
 
            parent_lines = [parent_cache[parent] for parent in parent_map[key]]
1096
 
            parent_cache[key] = list(
1097
 
                reannotate(parent_lines, lines, key, None, heads_provider))
1098
 
        return parent_cache[key]
 
1072
        ann = annotate.Annotator(self)
 
1073
        return ann.annotate_flat(key)
 
1074
 
 
1075
    def get_annotator(self):
 
1076
        return annotate.Annotator(self)
1099
1077
 
1100
1078
    def check(self, progress_bar=None):
1101
1079
        """See VersionedFiles.check()."""