~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to groupcompress.py

Initial stab at repository format support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    split_lines,
40
40
    )
41
41
from bzrlib.plugins.index2.btree_index import BTreeBuilder
 
42
from bzrlib.tsort import topo_sort
42
43
from bzrlib.versionedfile import (
43
44
    adapter_registry,
44
45
    AbsentContentFactory,
233
234
        writer = pack.ContainerWriter(stream.write)
234
235
        writer.begin()
235
236
        index = _GCGraphIndex(graph_index, lambda:True, parents=parents,
236
 
            deltas=delta, add_callback=graph_index.add_nodes)
 
237
            add_callback=graph_index.add_nodes)
237
238
        access = _DirectPackAccess({})
238
239
        access.set_writer(writer, graph_index, (transport, 'newpack'))
239
240
        result = GroupCompressVersionedFiles(index, access, delta)
570
571
class _GCGraphIndex(object):
571
572
    """Mapper from GroupCompressVersionedFiles needs into GraphIndex storage."""
572
573
 
573
 
    def __init__(self, graph_index, is_locked, deltas=False, parents=True,
 
574
    def __init__(self, graph_index, is_locked, parents=True,
574
575
        add_callback=None):
575
576
        """Construct a _GCGraphIndex on a graph_index.
576
577
 
577
578
        :param graph_index: An implementation of bzrlib.index.GraphIndex.
578
579
        :param is_locked: A callback to check whether the object should answer
579
580
            queries.
580
 
        :param deltas: Allow delta-compressed records.
581
581
        :param parents: If True, record knits parents, if not do not record 
582
582
            parents.
583
583
        :param add_callback: If not None, allow additions to the index and call
588
588
        """
589
589
        self._add_callback = add_callback
590
590
        self._graph_index = graph_index
591
 
        self._deltas = deltas
592
591
        self._parents = parents
593
 
        if deltas and not parents:
594
 
            # XXX: TODO: Delta tree and parent graph should be conceptually
595
 
            # separate.
596
 
            raise errors.KnitCorrupt(self, "Cannot do delta compression without "
597
 
                "parent tracking.")
598
592
        self.has_graph = parents
599
593
        self._is_locked = is_locked
600
594