Rev 3876: We should only care if the compression parent is not available, not if all parents are available. in http://bzr.arbash-meinel.com/branches/bzr/1.10-dev/304841-not-present-chain

John Arbash Meinel john at arbash-meinel.com
Wed Dec 3 22:25:06 GMT 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.10-dev/304841-not-present-chain

------------------------------------------------------------
revno: 3876
revision-id: john at arbash-meinel.com-20081203222454-f91otv07o8zgo2nv
parent: john at arbash-meinel.com-20081203222224-j2j5eef3jb38nloc
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 304841-not-present-chain
timestamp: Wed 2008-12-03 16:24:54 -0600
message:
  We should only care if the compression parent is not available, not if all parents are available.
-------------- next part --------------
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py	2008-11-27 08:26:50 +0000
+++ b/bzrlib/knit.py	2008-12-03 22:24:54 +0000
@@ -1035,6 +1035,7 @@
                 try:
                     record, record_details, digest, next = record_map[cursor]
                 except KeyError:
+                    import pdb; pdb.set_trace()
                     raise RevisionNotPresent(cursor, self)
                 components.append((cursor, record, record_details, digest))
                 cursor = next
@@ -1333,6 +1334,7 @@
                 adapter = adapter_factory(self)
                 adapters[adapter_key] = adapter
                 return adapter
+        delta_types = set()
         if self._factory.annotated:
             # self is annotated, we need annotated knits to use directly.
             annotated = "annotated-"
@@ -1342,11 +1344,13 @@
             annotated = ""
             convertibles = set(["knit-annotated-ft-gz"])
             if self._max_delta_chain:
+                delta_types.add("knit-annotated-delta-gz")
                 convertibles.add("knit-annotated-delta-gz")
         # The set of types we can cheaply adapt without needing basis texts.
         native_types = set()
         if self._max_delta_chain:
             native_types.add("knit-%sdelta-gz" % annotated)
+            delta_types.add("knit-%sdelta-gz" % annotated)
         native_types.add("knit-%sft-gz" % annotated)
         knit_types = native_types.union(convertibles)
         adapters = {}
@@ -1365,14 +1369,20 @@
         buffered_index_entries = {}
         for record in stream:
             parents = record.parents
+            if record.storage_kind in delta_types:
+                # TODO: eventually the record itself should track
+                #       compression_parent
+                compression_parent = parents[0]
+            else:
+                compression_parent = None
             # Raise an error when a record is missing.
             if record.storage_kind == 'absent':
                 raise RevisionNotPresent([record.key], self)
             elif ((record.storage_kind in knit_types)
-                  and (not parents
+                  and (compression_parent is None
                        or not self._fallback_vfs
-                       or not self._index.missing_keys(parents)
-                       or self.missing_keys(parents))):
+                       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
                 # compression parent OR we already have its basis in this kvf
                 # OR the basis is not present even in the fallbacks.  In the
@@ -1420,8 +1430,7 @@
                     #
                     # They're required to be physically in this
                     # KnitVersionedFiles, not in a fallback.
-                    compression_parent = parents[0]
-                    if self.missing_keys([compression_parent]):
+                    if not self._index.has_key(compression_parent):
                         pending = buffered_index_entries.setdefault(
                             compression_parent, [])
                         pending.append(index_entry)



More information about the bazaar-commits mailing list