Rev 3764: Tweak warning in commit about isinstance, and merge poolies commit fix for MemoryTree on a CHKInventory repository. in http://people.ubuntu.com/~robertc/baz2.0/repository

Robert Collins robertc at robertcollins.net
Wed Nov 12 07:24:02 GMT 2008


At http://people.ubuntu.com/~robertc/baz2.0/repository

------------------------------------------------------------
revno: 3764
revision-id: robertc at robertcollins.net-20081112072357-wutucalne8hi5q1p
parent: robertc at robertcollins.net-20081112044737-ra1awd1a74enm7mp
parent: mbp at sourcefrog.net-20081110072934-g98e0746d05xzdzf
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Wed 2008-11-12 18:23:57 +1100
message:
  Tweak warning in commit about isinstance, and merge poolies commit fix for MemoryTree on a CHKInventory repository.
modified:
  bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
    ------------------------------------------------------------
    revno: 3756.2.2
    revision-id: mbp at sourcefrog.net-20081110072934-g98e0746d05xzdzf
    parent: mbp at sourcefrog.net-20081110060816-awjurbz1zq485qtu
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: repository-trivial
    timestamp: Mon 2008-11-10 17:29:34 +1000
    message:
      Restore optimization in commit _report_and_accumulate_deletes
      (thanks lifeless)
    modified:
      bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
    ------------------------------------------------------------
    revno: 3756.2.1
    revision-id: mbp at sourcefrog.net-20081110060816-awjurbz1zq485qtu
    parent: robertc at robertcollins.net-20081106231431-km10poyn95ifnjkh
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: repository-trivial
    timestamp: Mon 2008-11-10 16:08:16 +1000
    message:
      commit code should not rely on inventory._byid
    modified:
      bzrlib/commit.py               commit.py-20050511101309-79ec1a0168e0e825
=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py	2008-11-06 23:00:22 +0000
+++ b/bzrlib/commit.py	2008-11-12 07:23:57 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006, 2007 Canonical Ltd
+# Copyright (C) 2005, 2006, 2007, 2008 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
@@ -77,7 +77,7 @@
                             )
 from bzrlib.testament import Testament
 from bzrlib.trace import mutter, note, warning, is_quiet
-from bzrlib.inventory import InventoryEntry, make_entry
+from bzrlib.inventory import Inventory, InventoryEntry, make_entry
 from bzrlib import symbol_versioning
 from bzrlib.symbol_versioning import (deprecated_passed,
         deprecated_function,
@@ -698,8 +698,18 @@
     def _report_and_accumulate_deletes(self):
         # XXX: Could the list of deleted paths and ids be instead taken from
         # _populate_from_inventory?
-        deleted_ids = set(self.basis_inv._byid.keys()) - \
-            set(self.builder.new_inventory._byid.keys())
+        if (isinstance(self.basis_inv, Inventory)
+            and isinstance(self.builder.new_inventory, Inventory)):
+            # Performance with commit was profiled extensively, and it found that
+            # using the keys (rather than eg building a set from the dict, or
+            # from the key iterator) of the Inventory._byid was faster at the
+            # time. We want to move away from doing this, but until careful
+            # profiling is done, we're preserving the old behaviour.
+            # <lifeless, poolie>
+            deleted_ids = set(self.basis_inv._byid.keys()) - \
+               set(self.builder.new_inventory._byid.keys())
+        else:
+            deleted_ids = set(self.basis_inv) - set(self.builder.new_inventory)
         if deleted_ids:
             self.any_entries_deleted = True
             deleted = [(self.basis_tree.id2path(file_id), file_id)




More information about the bazaar-commits mailing list