Rev 3916: As part of _check_should_delta, use the get_build_details api. in http://bzr.arbash-meinel.com/branches/bzr/1.11/knit_check_should_delta

John Arbash Meinel john at arbash-meinel.com
Wed Dec 24 17:37:26 GMT 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.11/knit_check_should_delta

------------------------------------------------------------
revno: 3916
revision-id: john at arbash-meinel.com-20081224173708-qi9ku7g5i6t826e6
parent: pqm at pqm.ubuntu.com-20081219200818-g19t5zbtkj52bwqp
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: knit_check_should_delta
timestamp: Wed 2008-12-24 11:37:08 -0600
message:
  As part of _check_should_delta, use the get_build_details api.
  
  This eliminates doing multiple queries to the index. It also improves correctness
  by using the compression parent, rather than assuming the delta chain follows
  left-hand parents.
-------------- next part --------------
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py	2008-12-19 18:11:34 +0000
+++ b/bzrlib/knit.py	2008-12-24 17:37:08 +0000
@@ -912,26 +912,25 @@
         delta_size = 0
         fulltext_size = None
         for count in xrange(self._max_delta_chain):
-            # XXX: Collapse these two queries:
             try:
                 # Note that this only looks in the index of this particular
                 # KnitVersionedFiles, not in the fallbacks.  This ensures that
                 # we won't store a delta spanning physical repository
                 # boundaries.
-                method = self._index.get_method(parent)
-            except RevisionNotPresent:
-                # Some basis is not locally present: always delta
+                build_details = self._index.get_build_details([parent])
+                parent_details = build_details[parent]
+            except RevisionNotPresent, KeyError:
+                # Some basis is not locally present: always fulltext
                 return False
-            index, pos, size = self._index.get_position(parent)
-            if method == 'fulltext':
+            index_memo, compression_parent, _, _ = parent_details
+            _, _, size = index_memo
+            if compression_parent is None:
                 fulltext_size = size
                 break
             delta_size += size
             # We don't explicitly check for presence because this is in an
             # inner loop, and if it's missing it'll fail anyhow.
-            # TODO: This should be asking for compression parent, not graph
-            # parent.
-            parent = self._index.get_parent_map([parent])[parent][0]
+            parent = compression_parent
         else:
             # We couldn't find a fulltext, so we must create a new one
             return False



More information about the bazaar-commits mailing list