At http://bzr.arbash-meinel.com/branches/bzr/brisbane/hack

------------------------------------------------------------
revno: 3825
revision-id: [email protected]
parent: [email protected]
parent: [email protected]
committer: John Arbash Meinel <[email protected]>
branch nick: hack
timestamp: Wed 2008-12-24 12:05:54 -0600
message:
  Merge the knit _check_should_delta fixes.
modified:
  bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
    ------------------------------------------------------------
    revno: 3735.28.141
    revision-id: [email protected]
    parent: [email protected]
    committer: John Arbash Meinel <[email protected]>
    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.
    modified:
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py    2008-12-23 21:37:19 +0000
+++ b/bzrlib/knit.py    2008-12-24 18:05:54 +0000
@@ -917,26 +917,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

-- 
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits

Reply via email to