/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: Martin Pool
  • Date: 2008-11-10 08:26:13 UTC
  • mto: This revision was merged to the branch mainline in revision 3826.
  • Revision ID: mbp@sourcefrog.net-20081110082613-gsg1fk1d6bpxy9xx
commit should not assume Inventories have a _byid dictionary

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
77
77
                            )
78
78
from bzrlib.testament import Testament
79
79
from bzrlib.trace import mutter, note, warning, is_quiet
80
 
from bzrlib.inventory import InventoryEntry, make_entry
 
80
from bzrlib.inventory import Inventory, InventoryEntry, make_entry
81
81
from bzrlib import symbol_versioning
82
82
from bzrlib.symbol_versioning import (deprecated_passed,
83
83
        deprecated_function,
702
702
    def _report_and_accumulate_deletes(self):
703
703
        # XXX: Could the list of deleted paths and ids be instead taken from
704
704
        # _populate_from_inventory?
705
 
        deleted_ids = set(self.basis_inv._byid.keys()) - \
706
 
            set(self.builder.new_inventory._byid.keys())
 
705
        if (isinstance(self.basis_inv, Inventory)
 
706
            and isinstance(self.builder.new_inventory, Inventory)):
 
707
            # the older Inventory classes provide a _byid dict, and building a
 
708
            # set from the keys of this dict is substantially faster than even
 
709
            # getting a set of ids from the inventory
 
710
            #
 
711
            # <lifeless> set(dict) is roughly the same speed as
 
712
            # set(iter(dict)) and both are significantly slower than
 
713
            # set(dict.keys())
 
714
            deleted_ids = set(self.basis_inv._byid.keys()) - \
 
715
               set(self.builder.new_inventory._byid.keys())
 
716
        else:
 
717
            deleted_ids = set(self.basis_inv) - set(self.builder.new_inventory)
707
718
        if deleted_ids:
708
719
            self.any_entries_deleted = True
709
720
            deleted = [(self.basis_tree.id2path(file_id), file_id)