/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/inventory.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-18 18:18:36 UTC
  • mto: This revision was merged to the branch mainline in revision 4461.
  • Revision ID: john@arbash-meinel.com-20090618181836-biodfkat9a8eyzjz
The new add_inventory_by_delta is returning a CHKInventory when mapping from NULL
Which is completely valid, but 'broke' one of the tests.
So to fix it, changed the test to use CHKInventories on both sides, and add an __eq__
member. The nice thing is that CHKInventory.__eq__ is fairly cheap, since it only
has to check the root keys.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1470
1470
        self._path_to_fileid_cache = {}
1471
1471
        self._search_key_name = search_key_name
1472
1472
 
 
1473
    def __eq__(self, other):
 
1474
        """Compare two sets by comparing their contents."""
 
1475
        if not isinstance(other, CHKInventory):
 
1476
            return NotImplemented
 
1477
 
 
1478
        this_key = self.id_to_entry.key()
 
1479
        other_key = other.id_to_entry.key()
 
1480
        this_pid_key = self.parent_id_basename_to_file_id.key()
 
1481
        other_pid_key = other.parent_id_basename_to_file_id.key()
 
1482
        if None in (this_key, this_pid_key, other_key, other_pid_key):
 
1483
            return False
 
1484
        return this_key == other_key and this_pid_key == other_pid_key
 
1485
 
1473
1486
    def _entry_to_bytes(self, entry):
1474
1487
        """Serialise entry as a single bytestring.
1475
1488