~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: Martin Pool
  • Date: 2011-02-14 02:37:04 UTC
  • mto: This revision was merged to the branch mainline in revision 5663.
  • Revision ID: mbp@canonical.com-20110214023704-zo532z3kb7y29aym
Rename to _immediate_fallback_vfs

Show diffs side-by-side

added added

removed removed

Lines of Context:
883
883
            self._factory = KnitAnnotateFactory()
884
884
        else:
885
885
            self._factory = KnitPlainFactory()
886
 
        self._immediate_fallbacks = []
 
886
        self._immediate_fallback_vfs = []
887
887
        self._reload_func = reload_func
888
888
 
889
889
    def __repr__(self):
897
897
 
898
898
        :param a_versioned_files: A VersionedFiles object.
899
899
        """
900
 
        self._immediate_fallbacks.append(a_versioned_files)
 
900
        self._immediate_fallback_vfs.append(a_versioned_files)
901
901
 
902
902
    def add_lines(self, key, parents, lines, parent_texts=None,
903
903
        left_matching_blocks=None, nostore_sha=None, random_id=False,
1070
1070
                    raise errors.KnitCorrupt(self,
1071
1071
                        "Missing basis parent %s for %s" % (
1072
1072
                        compression_parent, key))
1073
 
        for fallback_vfs in self._immediate_fallbacks:
 
1073
        for fallback_vfs in self._immediate_fallback_vfs:
1074
1074
            fallback_vfs.check()
1075
1075
 
1076
1076
    def _check_add(self, key, lines, random_id, check_content):
1226
1226
            and so on.
1227
1227
        """
1228
1228
        result = {}
1229
 
        sources = [self._index] + self._immediate_fallbacks
 
1229
        sources = [self._index] + self._immediate_fallback_vfs
1230
1230
        source_results = []
1231
1231
        missing = set(keys)
1232
1232
        for source in sources:
1526
1526
                        yield KnitContentFactory(key, global_map[key],
1527
1527
                            record_details, None, raw_data, self._factory.annotated, None)
1528
1528
                else:
1529
 
                    vf = self._immediate_fallbacks[parent_maps.index(source) - 1]
 
1529
                    vf = self._immediate_fallback_vfs[parent_maps.index(source) - 1]
1530
1530
                    for record in vf.get_record_stream(keys, ordering,
1531
1531
                        include_delta_closure):
1532
1532
                        yield record
1542
1542
            # record entry 2 is the 'digest'.
1543
1543
            result[key] = details[2]
1544
1544
        missing.difference_update(set(result))
1545
 
        for source in self._immediate_fallbacks:
 
1545
        for source in self._immediate_fallback_vfs:
1546
1546
            if not missing:
1547
1547
                break
1548
1548
            new_result = source.get_sha1s(missing)
1619
1619
                raise RevisionNotPresent([record.key], self)
1620
1620
            elif ((record.storage_kind in knit_types)
1621
1621
                  and (compression_parent is None
1622
 
                       or not self._immediate_fallbacks
 
1622
                       or not self._immediate_fallback_vfs
1623
1623
                       or self._index.has_key(compression_parent)
1624
1624
                       or not self.has_key(compression_parent))):
1625
1625
                # we can insert the knit record literally if either it has no
1797
1797
        # vfs, and hope to find them there.  Note that if the keys are found
1798
1798
        # but had no changes or no content, the fallback may not return
1799
1799
        # anything.
1800
 
        if keys and not self._immediate_fallbacks:
 
1800
        if keys and not self._immediate_fallback_vfs:
1801
1801
            # XXX: strictly the second parameter is meant to be the file id
1802
1802
            # but it's not easily accessible here.
1803
1803
            raise RevisionNotPresent(keys, repr(self))
1804
 
        for source in self._immediate_fallbacks:
 
1804
        for source in self._immediate_fallback_vfs:
1805
1805
            if not keys:
1806
1806
                break
1807
1807
            source_keys = set()
2016
2016
        """See VersionedFiles.keys."""
2017
2017
        if 'evil' in debug.debug_flags:
2018
2018
            trace.mutter_callsite(2, "keys scales with size of history")
2019
 
        sources = [self._index] + self._immediate_fallbacks
 
2019
        sources = [self._index] + self._immediate_fallback_vfs
2020
2020
        result = set()
2021
2021
        for source in sources:
2022
2022
            result.update(source.keys())
2062
2062
 
2063
2063
        missing_keys = set(nonlocal_keys)
2064
2064
        # Read from remote versioned file instances and provide to our caller.
2065
 
        for source in self.vf._immediate_fallbacks:
 
2065
        for source in self.vf._immediate_fallback_vfs:
2066
2066
            if not missing_keys:
2067
2067
                break
2068
2068
            # Loop over fallback repositories asking them for texts - ignore
3521
3521
        return records, ann_keys
3522
3522
 
3523
3523
    def _get_needed_texts(self, key, pb=None):
3524
 
        # if True or len(self._vf._immediate_fallbacks) > 0:
3525
 
        if len(self._vf._immediate_fallbacks) > 0:
 
3524
        # if True or len(self._vf._immediate_fallback_vfs) > 0:
 
3525
        if len(self._vf._immediate_fallback_vfs) > 0:
3526
3526
            # If we have fallbacks, go to the generic path
3527
3527
            for v in annotate.Annotator._get_needed_texts(self, key, pb=pb):
3528
3528
                yield v