Rev 3826: (mbp) commit should not assume Inventories have a _byid dictionary in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Nov 11 01:14:47 GMT 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3826
revision-id: pqm at pqm.ubuntu.com-20081111011444-02hohb7ghaqd3aa2
parent: pqm at pqm.ubuntu.com-20081107225426-gezbao014attrca8
parent: mbp at sourcefrog.net-20081110082613-gsg1fk1d6bpxy9xx
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2008-11-11 01:14:44 +0000
message:
(mbp) commit should not assume Inventories have a _byid dictionary
modified:
bzrlib/commit.py commit.py-20050511101309-79ec1a0168e0e825
------------------------------------------------------------
revno: 3825.1.1
revision-id: mbp at sourcefrog.net-20081110082613-gsg1fk1d6bpxy9xx
parent: pqm at pqm.ubuntu.com-20081107225426-gezbao014attrca8
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: integration
timestamp: Mon 2008-11-10 18:26:13 +1000
message:
commit should not assume Inventories have a _byid dictionary
modified:
bzrlib/commit.py commit.py-20050511101309-79ec1a0168e0e825
=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py 2008-10-03 23:42:56 +0000
+++ b/bzrlib/commit.py 2008-11-10 08:26:13 +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,
@@ -702,8 +702,19 @@
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)):
+ # the older Inventory classes provide a _byid dict, and building a
+ # set from the keys of this dict is substantially faster than even
+ # getting a set of ids from the inventory
+ #
+ # <lifeless> set(dict) is roughly the same speed as
+ # set(iter(dict)) and both are significantly slower than
+ # set(dict.keys())
+ 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