/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/knit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-02-20 01:26:08 UTC
  • mfrom: (4011.5.12 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090220012608-hh2rwz1cqd43mjrm
(robertc) Add the ability for KnitVersionedFiles backed by packs to
        scan a low level index for missing compression parent
        references. (Andrew Bennetts, Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1881
1881
                self._kndx_cache[prefix] = (orig_cache, orig_history)
1882
1882
                raise
1883
1883
 
 
1884
    def scan_unvalidated_index(self, graph_index):
 
1885
        """See _KnitGraphIndex.scan_unvalidated_index."""
 
1886
        # Because kndx files do not support atomic insertion via separate index
 
1887
        # files, they do not support this method.
 
1888
        raise NotImplementedError(self.scan_unvalidated_index)
 
1889
 
 
1890
    def get_missing_compression_parents(self):
 
1891
        """See _KnitGraphIndex.get_missing_compression_parents."""
 
1892
        # Because kndx files do not support atomic insertion via separate index
 
1893
        # files, they do not support this method.
 
1894
        raise NotImplementedError(self.get_missing_compression_parents)
 
1895
    
1884
1896
    def _cache_key(self, key, options, pos, size, parent_keys):
1885
1897
        """Cache a version record in the history array and index cache.
1886
1898
 
2196
2208
                "parent tracking.")
2197
2209
        self.has_graph = parents
2198
2210
        self._is_locked = is_locked
 
2211
        self._missing_compression_parents = set()
2199
2212
 
2200
2213
    def __repr__(self):
2201
2214
        return "%s(%r)" % (self.__class__.__name__, self._graph_index)
2263
2276
                result.append((key, value))
2264
2277
        self._add_callback(result)
2265
2278
        
 
2279
    def scan_unvalidated_index(self, graph_index):
 
2280
        """Inform this _KnitGraphIndex that there is an unvalidated index.
 
2281
 
 
2282
        This allows this _KnitGraphIndex to keep track of any missing
 
2283
        compression parents we may want to have filled in to make those
 
2284
        indices valid.
 
2285
 
 
2286
        :param graph_index: A GraphIndex
 
2287
        """
 
2288
        if self._deltas:
 
2289
            new_missing = graph_index.external_references(ref_list_num=1)
 
2290
            new_missing.difference_update(self.get_parent_map(new_missing))
 
2291
            self._missing_compression_parents.update(new_missing)
 
2292
 
 
2293
    def get_missing_compression_parents(self):
 
2294
        """Return the keys of compression parents missing from unvalidated
 
2295
        indices.
 
2296
        """
 
2297
        return frozenset(self._missing_compression_parents)
 
2298
 
2266
2299
    def _check_read(self):
2267
2300
        """raise if reads are not permitted."""
2268
2301
        if not self._is_locked():