Rev 5663: (mbp) rename _fallback_vfs to _immediate_fallback_vfs to make the meaning in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Feb 14 03:20:04 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5663 [merge]
revision-id: pqm at pqm.ubuntu.com-20110214032000-lwodgjs4kxn7ilyr
parent: pqm at pqm.ubuntu.com-20110212135944-g60tp8iryf0m620i
parent: mbp at canonical.com-20110214023704-zo532z3kb7y29aym
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2011-02-14 03:20:00 +0000
message:
  (mbp) rename _fallback_vfs to _immediate_fallback_vfs to make the meaning
   more clear (Martin Pool)
modified:
  bzrlib/groupcompress.py        groupcompress.py-20080705181503-ccbxd6xuy1bdnrpu-8
  bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
  bzrlib/tests/per_repository_reference/test_graph.py test_graph.py-20110208074011-b92ci87urjayd2q7-1
  bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
=== modified file 'bzrlib/groupcompress.py'
--- a/bzrlib/groupcompress.py	2011-02-09 06:35:00 +0000
+++ b/bzrlib/groupcompress.py	2011-02-14 02:37:04 +0000
@@ -1186,7 +1186,7 @@
             _unadded_refs = {}
         self._unadded_refs = _unadded_refs
         self._group_cache = LRUSizeCache(max_size=50*1024*1024)
-        self._fallback_vfs = []
+        self._immediate_fallback_vfs = []
 
     def without_fallbacks(self):
         """Return a clone of this object without any fallbacks configured."""
@@ -1266,7 +1266,7 @@
 
         :param a_versioned_files: A VersionedFiles object.
         """
-        self._fallback_vfs.append(a_versioned_files)
+        self._immediate_fallback_vfs.append(a_versioned_files)
 
     def annotate(self, key):
         """See VersionedFiles.annotate."""
@@ -1342,7 +1342,7 @@
             and so on.
         """
         result = {}
-        sources = [self._index] + self._fallback_vfs
+        sources = [self._index] + self._immediate_fallback_vfs
         source_results = []
         missing = set(keys)
         for source in sources:
@@ -1449,7 +1449,7 @@
         parent_map = {}
         key_to_source_map = {}
         source_results = []
-        for source in self._fallback_vfs:
+        for source in self._immediate_fallback_vfs:
             if not missing:
                 break
             source_parents = source.get_parent_map(missing)
@@ -1832,7 +1832,7 @@
         """See VersionedFiles.keys."""
         if 'evil' in debug.debug_flags:
             trace.mutter_callsite(2, "keys scales with size of history")
-        sources = [self._index] + self._fallback_vfs
+        sources = [self._index] + self._immediate_fallback_vfs
         result = set()
         for source in sources:
             result.update(source.keys())

=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py	2011-02-09 06:35:00 +0000
+++ b/bzrlib/knit.py	2011-02-14 02:37:04 +0000
@@ -883,7 +883,7 @@
             self._factory = KnitAnnotateFactory()
         else:
             self._factory = KnitPlainFactory()
-        self._fallback_vfs = []
+        self._immediate_fallback_vfs = []
         self._reload_func = reload_func
 
     def __repr__(self):
@@ -897,7 +897,7 @@
 
         :param a_versioned_files: A VersionedFiles object.
         """
-        self._fallback_vfs.append(a_versioned_files)
+        self._immediate_fallback_vfs.append(a_versioned_files)
 
     def add_lines(self, key, parents, lines, parent_texts=None,
         left_matching_blocks=None, nostore_sha=None, random_id=False,
@@ -1070,7 +1070,7 @@
                     raise errors.KnitCorrupt(self,
                         "Missing basis parent %s for %s" % (
                         compression_parent, key))
-        for fallback_vfs in self._fallback_vfs:
+        for fallback_vfs in self._immediate_fallback_vfs:
             fallback_vfs.check()
 
     def _check_add(self, key, lines, random_id, check_content):
@@ -1226,7 +1226,7 @@
             and so on.
         """
         result = {}
-        sources = [self._index] + self._fallback_vfs
+        sources = [self._index] + self._immediate_fallback_vfs
         source_results = []
         missing = set(keys)
         for source in sources:
@@ -1526,7 +1526,7 @@
                         yield KnitContentFactory(key, global_map[key],
                             record_details, None, raw_data, self._factory.annotated, None)
                 else:
-                    vf = self._fallback_vfs[parent_maps.index(source) - 1]
+                    vf = self._immediate_fallback_vfs[parent_maps.index(source) - 1]
                     for record in vf.get_record_stream(keys, ordering,
                         include_delta_closure):
                         yield record
@@ -1542,7 +1542,7 @@
             # record entry 2 is the 'digest'.
             result[key] = details[2]
         missing.difference_update(set(result))
-        for source in self._fallback_vfs:
+        for source in self._immediate_fallback_vfs:
             if not missing:
                 break
             new_result = source.get_sha1s(missing)
@@ -1619,7 +1619,7 @@
                 raise RevisionNotPresent([record.key], self)
             elif ((record.storage_kind in knit_types)
                   and (compression_parent is None
-                       or not self._fallback_vfs
+                       or not self._immediate_fallback_vfs
                        or self._index.has_key(compression_parent)
                        or not self.has_key(compression_parent))):
                 # we can insert the knit record literally if either it has no
@@ -1797,11 +1797,11 @@
         # vfs, and hope to find them there.  Note that if the keys are found
         # but had no changes or no content, the fallback may not return
         # anything.
-        if keys and not self._fallback_vfs:
+        if keys and not self._immediate_fallback_vfs:
             # XXX: strictly the second parameter is meant to be the file id
             # but it's not easily accessible here.
             raise RevisionNotPresent(keys, repr(self))
-        for source in self._fallback_vfs:
+        for source in self._immediate_fallback_vfs:
             if not keys:
                 break
             source_keys = set()
@@ -2016,7 +2016,7 @@
         """See VersionedFiles.keys."""
         if 'evil' in debug.debug_flags:
             trace.mutter_callsite(2, "keys scales with size of history")
-        sources = [self._index] + self._fallback_vfs
+        sources = [self._index] + self._immediate_fallback_vfs
         result = set()
         for source in sources:
             result.update(source.keys())
@@ -2062,7 +2062,7 @@
 
         missing_keys = set(nonlocal_keys)
         # Read from remote versioned file instances and provide to our caller.
-        for source in self.vf._fallback_vfs:
+        for source in self.vf._immediate_fallback_vfs:
             if not missing_keys:
                 break
             # Loop over fallback repositories asking them for texts - ignore
@@ -3521,8 +3521,8 @@
         return records, ann_keys
 
     def _get_needed_texts(self, key, pb=None):
-        # if True or len(self._vf._fallback_vfs) > 0:
-        if len(self._vf._fallback_vfs) > 0:
+        # if True or len(self._vf._immediate_fallback_vfs) > 0:
+        if len(self._vf._immediate_fallback_vfs) > 0:
             # If we have fallbacks, go to the generic path
             for v in annotate.Annotator._get_needed_texts(self, key, pb=pb):
                 yield v

=== modified file 'bzrlib/tests/per_repository_reference/test_graph.py'
--- a/bzrlib/tests/per_repository_reference/test_graph.py	2011-02-08 08:01:40 +0000
+++ b/bzrlib/tests/per_repository_reference/test_graph.py	2011-02-09 08:07:51 +0000
@@ -29,7 +29,7 @@
         See <https://bugs.launchpad.net/bugs/715000>.
         """
         branch_a, branch_b, branch_c, revid_1 = self.make_double_stacked_branches()
-        for br in [branch_c]:
+        for br in [branch_a, branch_b, branch_c]:
             self.assertEquals(
                 [revid_1],
                 br.repository.get_known_graph_ancestry([revid_1]).topo_sort())

=== modified file 'bzrlib/versionedfile.py'
--- a/bzrlib/versionedfile.py	2011-02-09 06:35:00 +0000
+++ b/bzrlib/versionedfile.py	2011-02-14 02:37:04 +0000
@@ -1,7 +1,4 @@
-# Copyright (C) 2006-2010 Canonical Ltd
-#
-# Authors:
-#   Johan Rydberg <jrydberg at gnu.org>
+# Copyright (C) 2006-2011 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -930,6 +927,10 @@
 
     The use of tuples allows a single code base to support several different
     uses with only the mapping logic changing from instance to instance.
+
+    :ivar _immediate_fallback_vfs: For subclasses that support stacking,
+        this is a list of other VersionedFiles immediately underneath this
+        one.  They may in turn each have further fallbacks.
     """
 
     def add_lines(self, key, parents, lines, parent_texts=None,
@@ -1201,7 +1202,7 @@
         at open time because they may change after the objects are opened.
         """
         all_fallbacks = []
-        for a_vfs in self._fallback_vfs:
+        for a_vfs in self._immediate_fallback_vfs:
             all_fallbacks.append(a_vfs)
             all_fallbacks.extend(a_vfs._transitive_fallbacks())
         return all_fallbacks




More information about the bazaar-commits mailing list