Rev 3925: (jam) Small updates to KnitVersionedFiles._check_should_delta in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jan 7 23:04:54 GMT 2009


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

------------------------------------------------------------
revno: 3925
revision-id: pqm at pqm.ubuntu.com-20090107230451-wf9c14ejiue3wvaj
parent: pqm at pqm.ubuntu.com-20090107110258-8hcbyd9v86mp7aw7
parent: john at arbash-meinel.com-20090107174210-nsut7i65b1c66d5n
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-01-07 23:04:51 +0000
message:
  (jam) Small updates to KnitVersionedFiles._check_should_delta
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
    ------------------------------------------------------------
    revno: 3915.3.3
    revision-id: john at arbash-meinel.com-20090107174210-nsut7i65b1c66d5n
    parent: john at arbash-meinel.com-20090107010457-n8kqegsuq1b17tqe
    parent: pqm at pqm.ubuntu.com-20090106171520-9pzjoqa7m74hvhht
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: knit_check_should_delta
    timestamp: Wed 2009-01-07 11:42:10 -0600
    message:
      Merge bzr.dev 3923, resolve NEWS
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/foreign.py              foreign.py-20081112170002-olsxmandkk8qyfuq-1
      bzrlib/patiencediff.py         patiencediff.py-20070721205536-jz8gaykeb7xtampk-1
      bzrlib/tests/test_diff.py      testdiff.py-20050727164403-d1a3496ebb12e339
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
      bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
      bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
      bzrlib/tests/workingtree_implementations/test_add.py test_add.py-20070226165239-4vo178spkrnhavc7-1
      bzrlib/tests/workingtree_implementations/test_basis_inventory.py test_basis_inventory.py-20051218151655-3650468941091309
      bzrlib/tests/workingtree_implementations/test_move.py test_move.py-20070225171927-mohn2vqj5fx7edc6-1
      bzrlib/tests/workingtree_implementations/test_rename_one.py test_rename_one.py-20070226161242-2d8ibdedl700jgio-1
      bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
      bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
      doc/en/user-guide/organizing_branches.txt organizing_branches.-20071123154453-dk2mjhrg1vpjm5w2-3
      doc/en/user-guide/publishing_a_branch.txt publishing_a_branch.-20071123055134-k5x4ekduci2lbn36-2
      doc/en/user-guide/reusing_a_checkout.txt reusing_a_checkout.t-20071123055134-k5x4ekduci2lbn36-3
      doc/en/user-guide/using_checkouts.txt using_checkouts.txt-20071123055134-k5x4ekduci2lbn36-4
      tools/win32/build_release.py   build_release.py-20081105204355-2ghh5cv01v1x4rzz-1
    ------------------------------------------------------------
    revno: 3915.3.2
    revision-id: john at arbash-meinel.com-20090107010457-n8kqegsuq1b17tqe
    parent: john at arbash-meinel.com-20081224173708-qi9ku7g5i6t826e6
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: knit_check_should_delta
    timestamp: Tue 2009-01-06 19:04:57 -0600
    message:
      Add NEWS entry.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3915.3.1
    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.
    modified:
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
=== modified file 'NEWS'
--- a/NEWS	2009-01-07 10:25:36 +0000
+++ b/NEWS	2009-01-07 23:04:51 +0000
@@ -148,6 +148,11 @@
       as base classes of ``WorkingTree4`` and ``WorkingTreeFormat4``
       respectively. (Ian Clatworthy)
 
+    * ``KnitVersionedFiles._check_should_delta()`` now uses the
+      ``get_build_details`` api to avoid multiple hits to the index, and
+      to properly follow the ``compression_parent`` rather than assuming
+      it is the left-hand parent. (John Arbash Meinel)
+
     * ``KnitVersionedFiles.get_record_stream()`` will now chose a
       more optimal ordering when the keys are requested 'unordered'.
       Previously the order was fully random, now the records should be

=== 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