~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/groupcompress.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-09-07 04:14:59 UTC
  • mfrom: (4675.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090907041459-so0m9vkp5j6mgir0
(robertc) Merge 2.0 to bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1811
1811
 
1812
1812
    def __init__(self, graph_index, is_locked, parents=True,
1813
1813
        add_callback=None, track_external_parent_refs=False,
1814
 
        inconsistency_fatal=True):
 
1814
        inconsistency_fatal=True, track_new_keys=False):
1815
1815
        """Construct a _GCGraphIndex on a graph_index.
1816
1816
 
1817
1817
        :param graph_index: An implementation of bzrlib.index.GraphIndex.
1837
1837
        self._is_locked = is_locked
1838
1838
        self._inconsistency_fatal = inconsistency_fatal
1839
1839
        if track_external_parent_refs:
1840
 
            self._key_dependencies = knit._KeyRefs()
 
1840
            self._key_dependencies = knit._KeyRefs(
 
1841
                track_new_keys=track_new_keys)
1841
1842
        else:
1842
1843
            self._key_dependencies = None
1843
1844
 
1897
1898
                    result.append((key, value))
1898
1899
            records = result
1899
1900
        key_dependencies = self._key_dependencies
1900
 
        if key_dependencies is not None and self._parents:
1901
 
            for key, value, refs in records:
1902
 
                parents = refs[0]
1903
 
                key_dependencies.add_references(key, parents)
 
1901
        if key_dependencies is not None:
 
1902
            if self._parents:
 
1903
                for key, value, refs in records:
 
1904
                    parents = refs[0]
 
1905
                    key_dependencies.add_references(key, parents)
 
1906
            else:
 
1907
                for key, value, refs in records:
 
1908
                    new_keys.add_key(key)
1904
1909
        self._add_callback(records)
1905
1910
 
1906
1911
    def _check_read(self):
1963
1968
        """Return the keys of missing parents."""
1964
1969
        # Copied from _KnitGraphIndex.get_missing_parents
1965
1970
        # We may have false positives, so filter those out.
1966
 
        self._key_dependencies.add_keys(
 
1971
        self._key_dependencies.satisfy_refs_for_keys(
1967
1972
            self.get_parent_map(self._key_dependencies.get_unsatisfied_refs()))
1968
1973
        return frozenset(self._key_dependencies.get_unsatisfied_refs())
1969
1974
 
2023
2028
 
2024
2029
        This allows this _GCGraphIndex to keep track of any missing
2025
2030
        compression parents we may want to have filled in to make those
2026
 
        indices valid.
 
2031
        indices valid.  It also allows _GCGraphIndex to track any new keys.
2027
2032
 
2028
2033
        :param graph_index: A GraphIndex
2029
2034
        """
2030
 
        if self._key_dependencies is not None:
2031
 
            # Add parent refs from graph_index (and discard parent refs that
2032
 
            # the graph_index has).
2033
 
            add_refs = self._key_dependencies.add_references
2034
 
            for node in graph_index.iter_all_entries():
2035
 
                add_refs(node[1], node[3][0])
2036
 
 
 
2035
        key_dependencies = self._key_dependencies
 
2036
        if key_dependencies is None:
 
2037
            return
 
2038
        for node in graph_index.iter_all_entries():
 
2039
            # Add parent refs from graph_index (and discard parent refs
 
2040
            # that the graph_index has).
 
2041
            key_dependencies.add_references(node[1], node[3][0])
2037
2042
 
2038
2043
 
2039
2044
from bzrlib._groupcompress_py import (