~jameinel/bzr/2.0.1-faster-get-deltas-bug374730

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: John Arbash Meinel
  • Date: 2009-09-24 19:26:45 UTC
  • Revision ID: john@arbash-meinel.com-20090924192645-hyy1ycnnk6u3j5j6
Catch a corner case that we were missing.
The CHKInventory tests were passing, but failed for test_inv because
we were passing None to _getitems(). That only failed for InternalNodes,
but we were using a structure that didn't have internal nodes.
So now the test is parameterized on a small CHKInventory page size
to force those things out into the open.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1576
1576
            foo-id, baz-id, frob-id, fringle-id
1577
1577
        As interesting ids.
1578
1578
        """
1579
 
        # When we hit the TREE_ROOT, we'll get an interesting parent of None,
1580
 
        # but we don't actually want to recurse into that
1581
 
        interesting = set([None])
 
1579
        interesting = set()
1582
1580
        # TODO: Pre-pass over the list of fileids to see if anything is already
1583
1581
        #       deserialized in self._fileid_to_entry_cache
1584
1582
 
1596
1594
        # parents of those parents. It also may have some duplicates with
1597
1595
        # specific_fileids
1598
1596
        remaining_parents = interesting.difference(file_ids)
 
1597
        # When we hit the TREE_ROOT, we'll get an interesting parent of None,
 
1598
        # but we don't actually want to recurse into that
 
1599
        interesting.add(None) # this will auto-filter it in the loop
 
1600
        remaining_parents.discard(None) 
1599
1601
        while remaining_parents:
 
1602
            if None in remaining_parents:
 
1603
                import pdb; pdb.set_trace()
1600
1604
            next_parents = set()
1601
1605
            for entry in self._getitems(remaining_parents):
1602
1606
                next_parents.add(entry.parent_id)
1606
1610
            remaining_parents = next_parents.difference(interesting)
1607
1611
            interesting.update(remaining_parents)
1608
1612
            # We should probably also .difference(directories_to_expand)
 
1613
        interesting.update(file_ids)
1609
1614
        interesting.discard(None)
1610
 
        interesting.update(file_ids)
1611
1615
        while directories_to_expand:
1612
1616
            # Expand directories by looking in the
1613
1617
            # parent_id_basename_to_file_id map
1636
1640
         parent_to_children) = self._expand_fileids_to_parents_and_children(
1637
1641
                                specific_fileids)
1638
1642
        entries = self.iter_entries()
1639
 
        # TODO: ???
1640
 
        # if self.root is None:
1641
 
        return Inventory(root_id=None)
1642
1643
        other = Inventory(entries.next()[1].file_id)
1643
1644
        other.root.revision = self.root.revision
1644
1645
        other.revision_id = self.revision_id